From:             felipensp at gmail dot com
Operating system: Linux
PHP version:      5.3CVS-2007-10-30 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  Converting $this to int

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 bug report at http://bugs.php.net/?id=43141&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43141&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43141&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43141&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43141&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43141&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43141&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43141&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43141&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43141&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43141&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43141&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43141&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43141&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43141&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43141&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43141&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43141&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43141&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43141&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43141&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43141&r=mysqlcfg

Reply via email to