File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug32660.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get))
    3: --FILE--
    4: <?php
    5: class A
    6: {
    7: 	public $q;
    8: 
    9: 	function __construct()
   10: 	{
   11: 		$this->q = 3;//array();
   12: 	}
   13: 
   14: 	function __get($name)
   15: 	{
   16: 		return $this->q;
   17: 	}
   18: }
   19: 
   20: $a = new A;
   21: 
   22: $b = "short";
   23: $c =& $a->whatever;
   24: $c = "long";
   25: print_r($a);
   26: $a->whatever =& $b;
   27: $b = "much longer";
   28: print_r($a);
   29: ?>
   30: --EXPECTF--
   31: Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20
   32: A Object
   33: (
   34:     [q] => 3
   35: )
   36: 
   37: Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23
   38: 
   39: Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>