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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC