Commit graph

27 commits

Author SHA1 Message Date
Arnaud Le Blanc
8d30ed4f80
Fix compiler warning in zend_test
Closes GH-16650
2024-11-05 16:51:43 +01:00
Ilija Tovilo
289f59ad48
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix handling of nested generator in zend_test observer
2024-10-22 14:52:07 +02:00
Ilija Tovilo
ce99adeb54
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix handling of nested generator in zend_test observer
2024-10-22 14:51:58 +02:00
Ilija Tovilo
69bcbdc3c5
Fix handling of nested generator in zend_test observer
This is the counterpart of GH-15952.

Fixes GH-16514
Closes GH-16530
2024-10-22 14:51:36 +02:00
Christoph M. Becker
909cecb7fa
Fix GH-16414: zend_test.observer.observe_function_names may segfault
Unless `zend_test.observer.enabled` is on, we must not add observer
handlers, so we let the INI modify handler fail early.

We also need to ensure that the functions to observe have already been
called, so that their begin and end handlers are properly initialized.
Otherwise we will not observe the function execution, but a segfault.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>

Closes GH-16438.
2024-10-20 12:11:08 +02:00
Ilija Tovilo
7d99355dad
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix segfault in zend_test_execute_internal()
2024-10-14 14:03:09 +02:00
Ilija Tovilo
0237361679
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix segfault in zend_test_execute_internal()
2024-10-14 14:03:01 +02:00
Ilija Tovilo
5c798415cd
Fix segfault in zend_test_execute_internal()
zend_pass_function also has no name, so we might also be referring to an
internal function here. In this case, ZEND_NEW uses the zend_pass_function when
there is no constructor.

Fixes GH-16294
Closes GH-16301
2024-10-14 14:02:36 +02:00
Bob Weinand
13c8d9317f Merge branch 'PHP-8.3' 2024-04-08 15:25:00 +02:00
Bob Weinand
f52b2a9cdc Merge branch 'PHP-8.2' into PHP-8.3 2024-04-08 15:10:29 +02:00
Bob Weinand
af098acd6e Always load EX(opline) into the current frame in JIT when observers are enabled
Fixes #13772.
Closes #13776.
2024-04-08 15:09:14 +02:00
Bob Weinand
a22a87243f
Add next handler parameter to zend_observer_remove_begin/end_handler (#13807)
The usage of the current API within an observer handler leads to bugs like https://bugs.xdebug.org/view.php?id=2232.
Given two observer handlers, next to each other. The first one is executed. It removes itself. The second observer handler gets moved to the place of the first. The first one returns. The handler in the second slot is fetched, but is now NULL, because the it's now in the slot of the first observer; i.e. the second handler is skipped and the begin/end symmetry guarantee is violated.

Providing the next handler to the caller is a zero-cost way to avoid any impact in the paths of zend_observe_fcall_begin/end.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-07 14:06:25 +02:00
Bob Weinand
a00e4a3649 Merge branch 'PHP-8.2' 2023-03-13 12:39:40 +01:00
Bob Weinand
ce2000d9be Merge branch 'PHP-8.1' of github.com:php/php-src into PHP-8.2 2023-03-13 12:39:15 +01:00
Bob Weinand
1015f1ff61 Add test, fix x86 JIT
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-03-13 12:36:59 +01:00
Max Kellermann
d5c649b36b
zend_compiler, ...: use uint8_t instead of zend_uchar (#10621)
`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers.  This is misleading, so let's use a
C99 integer instead.

On all architectures currently supported by PHP, `zend_uchar` and
`uint8_t` are identical.  This change is only about code readability.
2023-02-23 14:56:54 +00:00
Bob Weinand
bf427b732a Add an API to observe functions and classes being linked
To observe when the functions and classes start being officially available to the user

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-23 15:22:22 +02:00
Bob Weinand
b3b21ed558 Fix ZEND_RC_DEBUG build in zend_test observer tests 2022-07-31 14:32:35 +00:00
Bob Weinand
50a3fa49b6 Fix observer test 2022-07-31 14:02:48 +00:00
Bob Weinand
625f164963 Include internal functions in the observer API
There are two main motivations to this:
a) The logic for handling internal and userland observation can be unified.
b) Unwinding of observed functions on a bailout does notably not include observers. Even if users of observers were to ensure such handling themselves, it would be impossible to retain the relative ordering - either the user has to unwind all internal observed frames before the automatic unwinding (zend_observer_fcall_end_all) or afterwards, but not properly interleaved.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-30 19:20:55 +02:00
Bob Weinand
ac31e2e611 Fix memory_leak in zend_test
Properly use globals init/shutdown to allocate the observer_observe_function_names hashtable instead of attempting to do everything in the ini changed handler
2022-07-30 15:57:08 +00:00
Bob Weinand
9e2de4c2d9 Add an API to manipulate observers at runtime
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-29 13:48:05 +02:00
Nikita Popov
59ae64825d Release observed function name table 2021-09-16 10:38:28 +02:00
Bob Weinand
a8f06346ad Merge remote-tracking branch 'origin/PHP-8.0' into PHP-8.1 2021-09-13 16:15:55 +02:00
Joe Watkins
848b5458d1
more fiber notifications (#7293) 2021-07-21 17:18:15 +02:00
Martin Schröder
c5f9cdedd6
Flexible fiber bailout handling (#7163) 2021-06-18 11:01:10 -05:00
Aaron Piotrowski
d0c43e108e
Reorganize zend_test and add custom fiber implementation tests (#7137) 2021-06-11 12:25:47 -05:00