|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72615 Method __call is triggered instead of an existing method
Submitted: 2016-07-18 08:08 UTC Modified: 2020-07-21 18:32 UTC
Avg. Score:4.0 ± 0.7
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: madboy at gmail dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 5.6.23 OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
39 - 29 = ?
Subscribe to this entry?

 [2016-07-18 08:08 UTC] madboy at gmail dot com
Method __call is triggered instead of an existing method

Test script:
class A
    const METHOD = 'test';
    public function test()
    { echo 'test'; }
    public function __call($a, $b)
    { echo '__call'; }
    public function start()
    { $this->{self::METHOD}(); }
$obj = new A();

Expected result:
a string "test"

Actual result:
a string "__call"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-18 09:25 UTC]
-Status: Open +Status: Feedback
 [2016-07-18 09:25 UTC]
Working fine for me.
 [2016-07-18 10:09 UTC] madboy at gmail dot com
if I run this code from command line it works fine.
I get this problem only if I execute it through Apache (haven`t tried any other methods).
 [2016-07-18 13:52 UTC]
-Assigned To: +Assigned To: cmb
 [2016-07-18 13:52 UTC]
Is OPcache (or another bytecode cache) involved when you run on
 [2016-07-18 15:30 UTC] madboy at gmail dot com
I did have opcache enabled by default.
After I disabled it, I get an expected result from code snippet reported.

I tried this code on PHP 5.5 and 7.0.8 and it worked fine with default settings. Though I don`t know if I had cache enabled and I don`t have those docker containers right now.
 [2016-07-18 15:58 UTC]
-Package: Class/Object related +Package: opcache -Assigned To: cmb +Assigned To:
 [2016-07-18 15:58 UTC]
Thanks for the fast feedback!
 [2016-07-18 15:58 UTC]
-Status: Feedback +Status: Open
 [2020-07-21 17:39 UTC] smcbride at msn dot com
This bug has been open way too long.  Someone close it or fix it.  2016?  Give me a break.  4 years for a simple bug is ridiculous.
 [2020-07-21 18:32 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-07-21 18:32 UTC]
Happy to oblige. I can't reproduce this issue with or without opcache. If anyone can still reproduce this on a supported PHP version, please say so and I'll take another look.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 11:01:29 2024 UTC