php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60658 autoload broken in ZTS mode
Submitted: 2012-01-04 19:42 UTC Modified: 2013-02-18 00:35 UTC
Votes:11
Avg. Score:4.6 ± 0.8
Reproduced:9 of 9 (100.0%)
Same Version:6 (66.7%)
Same OS:4 (44.4%)
From: fedora at famillecollet dot com Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: 5.4SVN-2012-01-04 (snap) OS: GNU/Linux (Fedora 16)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-01-04 19:42 UTC] fedora at famillecollet dot com
Description:
------------
httpd + PHP 5.4.0RC5-dev (201201041830) + APC (svn 316786) : OK.

httpd.worker + PHP in ZTS mode without APC in ZTS mode : OK.

httpd.worker + PHP in ZTS mode + APC in ZTS mode : 
__autoload or spl_autoload_register only works on first call.



Test script:
---------------
Connect to phpMyAdmin

Minimal script.
<pre><?php
function my_autoload($name) {
 echo "autoload $name\n";
 include("$name.php");
}
echo "Start\n";
spl_autoload_register('my_autoload');
Foo::run();
?></pre>

Expected result:
----------------
Start
autoload Foo
In foo class


(which is also the result on first call, after apache start)

Actual result:
--------------
Start
autoload Foo


Fatal error:  Call to undefined method Foo::run() in /home/remi/public_html/autotest.php on line 8

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-02 15:34 UTC] xrstf-misc at yahoo dot com
The same happens to me using

Win7 x64
PHP 5.4.0 TS VC9 x86
Apache 2.2.19 x86
APC 3.1.9 (win7-DLL for 5.4 from 
https://github.com/stealth35/stealth35.github.com/downloads)

My script attempts to load a class, which succeeds the first time it's run. The 
second run stops with "undefined method MyClass::foo" message, even though a

print_r(get_class_methods('MyClass'));

right before the call to foo() correctly lists foo() as one of the methods in 
MyClass.

Disabling APC resolves the problem for me.
 [2012-03-08 22:32 UTC] ab@php.net
please test with the patch from https://bugs.php.net/bug.php?id=61219
 [2012-03-09 16:12 UTC] rk at mac dot hush dot com
I can confirm the patch from https://bugs.php.net/bug.php?id=61219 seems to fix 
the problem.
 [2012-03-09 16:23 UTC] remi@php.net
With APC rev324037, autoload still doesn't work for me (Gnu/linux, ZTS build).
 [2012-03-10 00:14 UTC] luath at hushmail dot com
The patch seems to work for me on rev 324069 (Win7 x64, ZTS build). Tested using 
provided test script.
 [2012-03-12 15:30 UTC] remi@php.net
I confirm that rev 324141 fix this bug (which is probably a duplicate of #61219)
 [2012-03-18 13:22 UTC] pajoye@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2012-03-18 13:22 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2012-03-18 17:53 UTC] remi@php.net
Yes, I confirm (again) that with rev324329 autoload works in NTS and ZTS mode
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 14:03:18 2021 UTC