static_properties_004.phpt 936 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Inherited static properties cannot be separated from their reference set.
  3. --FILE--
  4. <?php
  5. class C { public static $p = 'original'; }
  6. class D extends C { }
  7. class E extends D { }
  8. echo "\nInherited static properties refer to the same value across classes:\n";
  9. var_dump(C::$p, D::$p, E::$p);
  10. echo "\nChanging one changes all the others:\n";
  11. D::$p = 'changed.all';
  12. var_dump(C::$p, D::$p, E::$p);
  13. echo "\nReferences cannot be used to split the properties:\n";
  14. $ref = 'changed.one';
  15. D::$p =& $ref;
  16. var_dump(C::$p, D::$p, E::$p);
  17. ?>
  18. ==Done==
  19. --EXPECT--
  20. Inherited static properties refer to the same value across classes:
  21. string(8) "original"
  22. string(8) "original"
  23. string(8) "original"
  24. Changing one changes all the others:
  25. string(11) "changed.all"
  26. string(11) "changed.all"
  27. string(11) "changed.all"
  28. References cannot be used to split the properties:
  29. string(11) "changed.one"
  30. string(11) "changed.one"
  31. string(11) "changed.one"
  32. ==Done==