Bug #68648 [Opn->Nab]: call_user_func inside __callStatic cause segmentation fault

From: Date: Wed, 24 Dec 2014 22:51:05 +0000
Subject: Bug #68648 [Opn->Nab]: call_user_func inside __callStatic cause segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189188@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68648&edit=1 ID: 68648 Updated by: requinix@php.net Reported by: valentiny510 at gmail dot com Summary: call_user_func inside __callStatic cause segmentation fault -Status: Open +Status: Not a bug Type: Bug Package: Reproducible crash Operating System: Windows 8 x64 PHP Version: 5.6.4 Block user comment: N Private report: N New Comment: is_callable() will return true because you've implemented __callStatic. You created infinite recursion. method_exists() won't do that. Previous Comments: ------------------------------------------------------------------------ [2014-12-24 15:08:20] valentiny510 at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=68648&edit=1

« previous php.bugs (#189188) next »