Bug #68648 [NEW]: call_user_func inside __callStatic cause segmentation fault

From: Date: Wed, 24 Dec 2014 15:08:21 +0000
Subject: Bug #68648 [NEW]: call_user_func inside __callStatic cause segmentation fault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189181@lists.php.net to get a copy of this message
From: valentiny510 at gmail dot com Operating system: Windows 8 x64 PHP version: 5.6.4 Package: Reproducible crash Bug Type: Bug Bug description:call_user_func inside __callStatic cause segmentation fault Description: ------------ This piece of code make my apache to restart with status 3221225477. One quick search on the web and find that is a segmentation fault on windows. #define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005L) I tried different combinations, with or without namespace, etc.., but the result is always the same, Ex: call_user_func(array('X', $method)); call_user_func(__NAMESPACE__ . '\X::exist'); call_user_func(array(__NAMESPACE__ . '\X', 'exist')); I guess will recursively call the same method over and over but at least php should not crash the apache or throw something Test script: --------------- <?php namespace Y; class X { public static function __callStatic($method, $args) { if (is_callable([__CLASS__, $method])) { if (empty($args)) { call_user_func([__CLASS__, $method]); return; } call_user_func([__CLASS__, $method], join(',', $args)); return; } throw new Exception("The class '" . __CLASS__ . "' does not have a method called '$method'"); } } var_dump(X::exist('la bla')); Expected result: ---------------- The class 'X' does not have a method called 'exist' Actual result: -------------- apache shutdown and restart -- Edit bug report at https://bugs.php.net/bug.php?id=68648&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68648&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68648&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68648&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68648&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68648&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68648&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68648&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68648&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68648&r=support Expected behavior: https://bugs.php.net/fix.php?id=68648&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68648&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68648&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68648&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68648&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68648&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68648&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68648&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68648&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68648&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68648&r=mysqlcfg

« previous php.bugs (#189181) next »