|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-04-10 22:22 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 12:00:01 2025 UTC |
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.