ID:               43141
 Updated by:       [EMAIL PROTECTED]
 Reported By:      felipensp at gmail dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.3CVS-2007-10-30 (snap)
 New Comment:

Yes, it's inconsistent but we won't change it (soon).


Previous Comments:
------------------------------------------------------------------------

[2007-10-30 12:42:21] felipensp at gmail dot com

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)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43141&edit=1

Reply via email to