php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56179 inherit method is not updated when parent class file updated
Submitted: 2004-08-23 23:34 UTC Modified: 2012-07-08 03:33 UTC
From: xuefer at 21cn dot com Assigned: chx (profile)
Status: Closed Package: APC (PECL)
PHP Version: 4.3.3 OS: linux
Private report: No CVE-ID: None
 [2004-08-23 23:34 UTC] xuefer at 21cn dot com
Description:
------------
1. load test.php in browser (via apache+php+apc)
2. update "in p2" to "in p2**" (*** is random text)
3. reload test.php, nothing changed (even with ctrl+f5 in ie, reload with nocache)

4. uncomment class p3::set
5. do 1-3, message is updated

Reproduce code:
---------------
test.php:
require("./p12.php");
require("./p3.php");
$p3 = new p3();
$p3->set();

p12.php
class p1
{
function set()
{
echo "in p1<br>";
}
}

class p2 extends p3
{
function set()
{
echo "in p2<br>";
return parent::set();
}
}

p3.php
class p3 extends p2
{
/* if this exists, no error
function set()
{
echo "in p3<br>";
return parent::set();
}
*/
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-07 00:16 UTC] rasmus@php.net
This example doesn't work without APC either.  Did you really mean to have p3 extend p2 and p2 extend p3 here?
 [2004-09-07 04:38 UTC] xuefer at 21cn dot com
sorry, it's my typo while reporting this bug

class p3 extends p2
class p2 extends p1 (not p3)

p1 and p2 in same file(p12.php), while p3 is alone(p3.php)

update code in class p2::set() (file p12.php)
no errors/warnnings, but result it wrong

may times i have to re-update the file or clear apc cache
 [2004-09-07 12:42 UTC] rasmus@php.net
I still can't reproduce this with the current CVS version of APC.

With set() in p3 commented I see:

in p2
in p1

And when I uncomment it I see:

in p3
in p2
in p1

consistently.

Could you try building the current CVS code and make sure you are still seeing this problem?
 [2004-09-07 13:19 UTC] xuefer at 21cn dot com
updated summary.

verified with lastest apc

i think my mistake make u ignored my "reproduce steps"

step 1-3 is required to reproduce the bug
without p3::set, compare result of 3 to 1, result is(but shouldn't be) same until i `touch p3.php`, this is the bug.
u may try steps2-3 more times

step 4-5 is an exception of the bug(i.e.: not a bug)

i've once trace apc optimizer, and noticed some function opcode is optimized twice.
(the following notes is just my guessing, hope it help to explain this bug)
situtation 1: without p3::set
it seems apc copied all methods from p2 (p2::set) to class p3, once p2 is updated, p3 is not, this is the bug

situtation 1: with p3::set
p3 has it's own p3::set thus won't copy p2::set to p3::set, thus not triggering this bug
 [2004-09-07 13:43 UTC] rasmus@php.net
I did follow your steps.  But I don't have the optimizer enabled.  Can you verify that this problem disappears when you disable the optimizer?
 [2004-09-12 02:39 UTC] xuefer at 21cn dot com
my config is:
extension = apc.so
apc.enabled = 1
apc.optimization = 1
apc.ttl = 3600


verified with:
apc.enabled = 1
apc.optimization = 0

ok with:
apc.enabled = 0
apc.optimization = 0
 [2004-09-19 03:30 UTC] Rasmus@php.net
Ok, I did reproduce this now.  

My guess is that there is a check on a function HashTable somewhere that terminates a loop that otherwise would have climbed the dependency tree if class p3 hadn't been empty.  Didn't see it though skimming through apc_compile.c.  Having a property in the p3 class doesn't help.  Only a method clears this one up.
 [2012-07-08 03:33 UTC] chx@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: chx
 [2012-07-08 03:33 UTC] chx@php.net
APC bug queue cleanup.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 07:01:30 2024 UTC