|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-30 16:52 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 21 16:00:01 2025 UTC |
Description: ------------ When try converter $this to string, one Catchable fatal error occur. $this to int, only Notice... Reproduce code: --------------- <?php error_reporting(E_ALL); class foo { public $test = 'foo'; public function __construct() { $this++; // don't convert ++$this; // don't convert //$this .= ''; // Catchable fatal error: Object of class foo could not be converted to string $this += 1; // Notice: Object of class foo could not be converted to int var_dump($this); //int(2) // $this->$this; // Odd... Notice: Undefined property: foo::$2 var_dump($this->test); // foo var_dump($this); // int(2) } } new foo; Expected result: ---------------- Catchable fatal error: Object of class foo could not be converted to int Actual result: -------------- Notice: Object of class foo could not be converted to int in /home/felipe/public_html/bug.php on line 16 int(2) string(3) "foo" int(2)