Bug #78046 [NEW]: pcntl_async_signals breaks down magic getter

From: Date: Tue, 21 May 2019 09:45:20 +0000
Subject: Bug #78046 [NEW]: pcntl_async_signals breaks down magic getter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220924@lists.php.net to get a copy of this message
From: toxbyte at gmail dot com Operating system: Ubuntu PHP version: 7.3.5 Package: PCNTL related Bug Type: Bug Bug description:pcntl_async_signals breaks down magic getter Description: ------------ When use "pcntl_async_signals(true)" and try to access the magic property from async signal handler and regular way in same time, get error "Undefined property". PHP 7.1 7.2 7.3: docker run -it --rm -v "$PWD":/app php:7.1.29-cli sh -c "docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" pcntl && php /app/test-magic.php" docker run -it --rm -v "$PWD":/app php:7.2.18-cli sh -c "docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" pcntl && php /app/test-magic.php" docker run -it --rm -v "$PWD":/app php:7.3.5-cli sh -c "docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" pcntl && php /app/test-magic.php" Test script: --------------- <?php //test-magic.php $obj = new TestMagic; $childrenCount = 100; $completed = 0; pcntl_async_signals(true); set_error_handler(static function (int $errNo, string $errStr) { throw new \ErrorException("ERROR #{$errNo}: {$errStr}"); }); pcntl_signal(SIGINT, static function () {exit;}); pcntl_signal(SIGTERM, static function () {exit;}); pcntl_signal(SIGCHLD, static function () use ($obj, &$completed) { $completed++; echo "ASYNC ACCESS #{$completed} "; echo "{$obj->x}\n"; }); $inRun = 0; while (++$inRun <= $childrenCount) { proc_open('sleep ' . (random_int(1, 999) / 1000), [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes); } while ($completed < $childrenCount) { echo "BLOCKING ACCESS #{$completed} "; echo "{$obj->x}\n"; } /** @property $x */ class TestMagic { public function __set($name, $value) { return null; } public function __get($name) { return 'OK'; } public function __isset($name) { return true; } } // ... // BLOCKING ACCESS #5 OK // BLOCKING ACCESS #5 ASYNC ACCESS #6 // Fatal error: Uncaught ErrorException: ERROR #8: Undefined property: TestMagic::$x in /app/test-magic.php:9 // Stack trace: // #0 /app/test-magic.php(17): {closure}(8, 'Undefined prope...', '/app/test-magic...', 17, Array) // #1 /app/test-magic.php(41): {closure}(17, Array) // #2 /app/test-magic.php(27): TestMagic->__get('x') // #3 {main} // thrown in /app/test-magic.php on line 9 // Segmentation fault (core dumped) -- Edit bug report at https://bugs.php.net/bug.php?id=78046&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78046&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78046&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78046&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78046&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78046&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78046&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78046&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78046&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78046&r=support Expected behavior: https://bugs.php.net/fix.php?id=78046&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78046&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78046&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78046&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78046&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78046&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78046&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78046&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78046&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78046&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78046&r=mysqlcfg

« previous php.bugs (#220924) next »