Opened 8 years ago

Closed 8 years ago

#36 closed defect (fixed)

Bug in inherited static class variables

Reported by: Vladan Zajda Owned by: moo
Priority: major Milestone: 1.2
Component: cacher Version: 1.0.2
Keywords: static class variable Cc:
Application: PHP Version:
Other Exts: SAPI:
Probability: Blocked By:
Blocking:

Description

Hello,
There is a bug in inherited static class variable when using cached php. The value of inherited static variable is altered back to its initial value.
Tested only on WinXP/PHP 5.1.6 using XCache 1.0.2 but this seems to be global bug.

Here's an example:

<?php
         
class B {
   static protected $B = 'initial value';
  
   public static function setB($value) {
      if ($value) {
         self::$B = 'different value';
      }
   }

   public function showBinB() {
      echo "static \$B in B = " . self::$B . "<br />";
   }
}

class C extends B {
   public function showBinC() {
      echo "static \$B in C = " . self::$B . "<br />";
   }    
}

B::setB(true);
$c = new C();
$c->showBinB();
$c->showBinC();

?>

Change History (9)

comment:1 Changed 8 years ago by moo

  • Status changed from new to assigned

comment:2 Changed 8 years ago by moo

  • Milestone changed from 1.1 to 1.0.3
  • Version changed from 1.0.1 to 1.0.2

comment:3 Changed 8 years ago by judas_iscariote

Vladan Zajda, nice catch ;), I haven't found this on my rutinary tests.

reproduced in current SVN too .

comment:4 Changed 8 years ago by moo

  • Resolution set to fixed
  • Status changed from assigned to closed

in [196], not well tested yet.

comment:5 Changed 8 years ago by judas_iscariote

  • Resolution fixed deleted
  • Status changed from closed to reopened

not fixed yet. child exists with signal aborted

mismatch `dst->arBuckets',`Bucket*',`src->nTableSize',`1' at line 7533(was 1184): real 64 - expect 69 = 18446744073709551611
mismatch `dst->arBuckets',`Bucket*',`src->nTableSize',`1' at line 8738(was 2852): real 64 - expect 24 = 40
mismatch `pnew',`char',`bucketsize',`',`Bucket' at line 8783(was 1159): real 73 - expect 64 = 9
mismatch `pnew->pData',`zend_function' at line 8854(was 2035): real 232 - expect 64 = 168
mismatch `dst->refcount',`zend_uint' at line 12366(was 2060): real 4 - expect 73 = 18446744073709551547
mismatch `dst->opcodes',`zend_op',`src->last' at line 12431(was 2094): real 840 - expect 232 = 608
mismatch `ZSTR_V(ret)',`char',`realsize' at line 9489(was 4957): real 18 - expect 4 = 14
mismatch `dst->vars',`zend_compiled_variable',`src->last_var' at line 12536(was 4988): real 24 - expect 840 = 18446744073709550800
mismatch `pnew',`char',`bucketsize',`',`Bucket' at line 8783(was 2584): real 69 - expect 18 = 51
mismatch `pnew->pData',`zend_function' at line 8854(was 5062): real 232 - expect 24 = 208
mismatch `dst->arg_info',`zend_arg_info',`src->num_args' at line 12172(was 2060): real 40 - expect 69 = 18446744073709551587
mismatch `dst->refcount',`zend_uint' at line 12366(was 2094): real 4 - expect 232 = 18446744073709551388
mismatch `dst->opcodes',`zend_op',`src->last' at line 12431(was 4819): real 960 - expect 40 = 920
mismatch `dst->vars',`zend_compiled_variable',`src->last_var' at line 12536(was 4957): real 48 - expect 4 = 44
mismatch `pnew',`char',`bucketsize',`',`Bucket' at line 8783(was 4988): real 73 - expect 960 = 18446744073709550729
mismatch `pnew->pData',`zend_function' at line 8854(was 5062): real 232 - expect 48 = 184
mismatch `dst->refcount',`zend_uint' at line 12366(was 2060): real 4 - expect 73 = 18446744073709551547
mismatch `dst->opcodes',`zend_op',`src->last' at line 12431(was 2094): real 840 - expect 232 = 608
mismatch `dst->vars',`zend_compiled_variable',`src->last_var' at line 12536(was 4957): real 24 - expect 4 = 20
real 11976 - should 12072 = -96
[Sun Sep 24 04:18:39 2006] [notice] child pid 1328 exit signal Aborted (6)

comment:6 Changed 8 years ago by moo

  • Resolution set to fixed
  • Status changed from reopened to closed

in [199], i should have checked it with --enable-xcache-test :)

comment:7 Changed 8 years ago by moo

  • Milestone changed from 1.0.3 to 1.2

comment:8 Changed 8 years ago by moo

  • Resolution fixed deleted
  • Status changed from closed to reopened

static variable is not handled correctly, which breaks testcase Zend/tests/bug28442.phpt

comment:9 Changed 8 years ago by moo

  • Resolution set to fixed
  • Status changed from reopened to closed

in [220]

Note: See TracTickets for help on using tickets.