Bug #69423 [Opn->Nab]: Crashing on recursive magic method calling
| From: | requinix@php.net | Date: | Fri, 10 Apr 2015 23:29:14 +0000 |
| Subject: | Bug #69423 [Opn->Nab]: Crashing on recursive magic method calling | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191950@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69423&edit=1
ID: 69423
Updated by: requinix@php.net
Reported by: contact at geolim4 dot com
Summary: Crashing on recursive magic method calling
-Status: Open
+Status: Not a bug
Type: Bug
Package: Reproducible crash
PHP Version: 5.6.7
Block user comment: N
Private report: N
New Comment:
public static function __callStatic($name, array $arguments)
{
return call_user_func_array( [__CLASS__, $name], $arguments );
}
Infinite recursion. Typically one of two things will happen:
1. There's enough code executing during the recursion that you hit PHP's configured memory
limit, which is a fatal error.
2. Stack overflow, which the system responds to by segfaulting the process, and that's not
under PHP's control. This is what's happening to you.
If you're concerned about infinite recursion during development, install Xdebug and configure
the max_nesting_level setting.
http://xdebug.org/docs/basic#max_nesting_level
Regarding that code, it is only good for attempting to call a private/protected static member from
outside the allowed scope; public static methods never need to be wrapped by __callStatic().
Since it will also be called for any non-existent method you should always validate $name.
Previous Comments:
------------------------------------------------------------------------
[2015-04-10 22:22:37] contact at geolim4 dot com
Description:
------------
When you call a method through callStatic() and pass the method name to call_user_func_array(), php
is crashing expectedly. It look stupid, but php shouldn't return a fatal error in that case
instead of crashing?
Apache error log:
____________________
[Sat Apr 11 00:08:19 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28762) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:08:19 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28761) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:08:43 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28765) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:08:43 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28764) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:08:48 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28767) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:08:48 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28766) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:10:51 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28884) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:10:51 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28802) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:13:02 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28912) exit(communication error), get
unexpected signal 11
[Sat Apr 11 00:13:02 2015] [error] mod_fcgid: process
/var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web5(28911) exit(communication error), get
unexpected signal 11
Test script:
---------------
http://pastebin.com/5p4cWHp3
Expected result:
----------------
A fatal error
Actual result:
--------------
A fcgi process crash.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69423&edit=1