|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-12-24 15:08 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 23:00:01 2025 UTC |
Ok, my bad using is_callable, but even so, the method should have a limit for the recursion or try to detect if the tested callable method is the same method from where was called and this way avoit the problem, in my opinion is still a bug but for is_callable. Why you cant do something similar to this ? function is_callable($method) { if ($method == __FUNCTION__) return; break; whatever... # Do the loop here... } the thing is, php should never have the ability to break other things like in this case the apache, run in some sandbox style, test the code in the background and then push into some opcache Cheers !