Closed rlerdorf closed 3 years ago
I'm having a hard time reproducing this:
krakjoe@Fiji:/opt/src/uopz_test$ php -v
PHP 8.0.8 (cli) (built: Jul 28 2021 09:25:18) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
krakjoe@Fiji:/opt/src/uopz_test$ php -n vendor/bin/phpunit tests/accObjTest.php
PHPUnit 9.5.7 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 00:00.003, Memory: 4.00 MB
OK (1 test, 1 assertion)
krakjoe@Fiji:/opt/src/uopz_test$ php vendor/bin/phpunit tests/accObjTest.php
PHPUnit 9.5.7 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 00:00.007, Memory: 4.00 MB
OK (1 test, 1 assertion)
I've also tried tip of 8.0 branch, and debug builds, both with and without opcache ...
Any more clues ?
Here is a stab in the dark ...
diff --git a/src/util.c b/src/util.c
index 8f8d2cd..8ebbfdf 100644
--- a/src/util.c
+++ b/src/util.c
@@ -218,7 +218,11 @@ static void uopz_callers_shutdown(void) { /* {{{ */
uopz_caller_switch(&uopz_call_user_func_array_ptr->handler, &zend_call_user_func_array_ptr->handler);
} /* }}} */
-#define UOPZ_CALL_HOOKS(variadic) \
+#define UOPZ_CALL_HOOKS(variadic) do { \
+ if (!fcc.function_handler) { \
+ break; \
+ } \
+ \
{ \
uopz_hook_t *uhook = uopz_find_hook(fcc.function_handler); \
\
@@ -243,8 +247,8 @@ static void uopz_callers_shutdown(void) { /* {{{ */
ZVAL_COPY(return_value, &ureturn->value); \
return; \
} \
- } while (0)
-
+ } while (0); \
+} while (0)
/* {{{ proto mixed uopz_call_user_func(callable function, ... args) */
PHP_FUNCTION(uopz_call_user_func) {
zval retval;
Any good ?
I managed to reproduce, the above patch was committed and should fix it: Magic may nullify handler, I'm surprised we didn't see this before.
Thanks for the quick fix. I just realized now when I went to check the other PHP versions that I didn't have uopz enabled correctly for those. So ignore the part about 7.4 and 8.1 not being affected from my original report.
I am seeing a segfault with PHP 8.0 and uopz when calling
uopz_call_user_func_array()
that hits a__call()
method on a tricky wrapped object. The wrapper is a test helper that changes the access level of private and protected methods if they have been marked as accessible for testing.To reproduce, grab uopz_test.tar.gz,
composer install
and runvendor/bin/phpunit tests/accObjTest.php
with PHP 8.0 and uopz, of course. It passes with PHP 7.4 and strangely enough, it also passes with PHP 8.1. With PHP 8.0.8 I am seeing a crash at thefunction->common.function_name
check becausefunction
is0x0
. (recompiled with -O0 to verify that)