1--TEST-- 2Fixed execute_data corruption with __toString() 3--FILE-- 4<?php 5 6class Test 7{ 8 public $something = 'hello'; 9 10 public function __toString() 11 { 12 return $this->something; 13 } 14} 15 16$t = new Test; 17var_dump(strlen($t)); 18var_dump($t->something); 19 20class Test2 21{ 22 public $something; 23 24 public function __construct(&$a) 25 { 26 $this->something = &$a; 27 } 28 29 public function __toString() 30 { 31 return $this->something; 32 } 33} 34 35$a = 'world'; 36$t2 = new Test2($a); 37var_dump(strlen($t2)); 38var_dump($t2->something); 39var_dump($a); 40 41$a = 'foobar'; 42var_dump(strlen($t2)); 43var_dump($t2->something); 44?> 45--EXPECT-- 46int(5) 47string(5) "hello" 48int(5) 49string(5) "world" 50string(5) "world" 51int(6) 52string(6) "foobar" 53