- var_dump: documentation ( source)
- str_replace: documentation ( source)
<?php
// Source: https://bugs.php.net/bug.php?id=60475
class Primary {
public function __toString() {
$GLOBALS['anObject'] = $this;
return 'toString output from Primary';
}
}
$Foo = new Primary;
str_replace('', '', $Foo);
var_dump($GLOBALS['anObject']);
// expected to be object of class Primary, actually string