PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Bug #2202

inherit method is not updated when parent class file updated

Details

#2202inherit method is not updated when parent class file updated
Submitted2004-08-24 03:34 UTC
Fromxuefer at 21cn dot com
StatusOpen
PHP Version4.3.3
OSlinux
Roadmaps(Not assigned)

Comments

[2004-08-24 03: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();
}
*/
}

[2004-09-07 08: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 17: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-12 06: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