php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55020 __callStatic with __call causes crash
Submitted: 2011-06-09 21:03 UTC Modified: 2011-06-10 14:33 UTC
From: ebert at woltlab dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.6 OS: Windows 7 x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ebert at woltlab dot com
New email:
PHP Version: OS:

 

 [2011-06-09 21:03 UTC] ebert at woltlab dot com
Description:
------------
PHP crashes if a __call()- and __callStatic()-method exists, whereas __call() redirects calls to __callStatic(), this is likely related to http://bugs.php.net/bug.php?id=49542

System:
Microsoft IIS 7.5
PHP 5.3.6 NTS

Test script:
---------------
Foo-Class (crashes): http://nopaste.php-quake.net/27860
Bar-Class (work-around): http://nopaste.php-quake.net/27861

Expected result:
----------------
// Foo-Class
Called static method one()
Called static method three()

// Bar-Class
Called static method one()
Called static method three()

Actual result:
--------------
// Foo-Class
PHP-Crash

// Bar-Class
Called static method one()
Called static method three()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-09 23:42 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-06-09 23:42 UTC] felipe@php.net
The crash is caused by call stack overflow due Foo::three() be called with object context, so __call() is called instead of __callStatic().
You just need to make the method 'two' static, so __callStatic() will be called.
 [2011-06-10 14:33 UTC] ebert at woltlab dot com
Maybe my example wasn't sufficient enough to show the problem, imagine the following code [1] which causes a crash too. I would expect some kind of error handling, instead of PHP just going down.

Once again this is related to PHPs "feature" to allow static calls from non-static context and vise versa but this should not cause a crash anyway.

http://nopaste.php-quake.net/28028
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 15:01:30 2025 UTC