php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23522 Negative valus in variable declaration in classes
Submitted: 2003-05-07 00:44 UTC Modified: 2003-05-07 05:56 UTC
From: wima at tiscali dot ch Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.3.2RC2 OS: Windows XP Professional
Private report: No CVE-ID: None
 [2003-05-07 00:44 UTC] wima at tiscali dot ch
Hello
This script does output 0 instead of -1. If I initialize the variable a in the constructor (the commented line) the output is correct. I'm not shure if it is a bug, but if I initialize the variable with a positive value it works correct.
Thanks for fixing this bug.
Marco
<?
$a = new myClass;
class myClass {
 var $a = -1;

 function myClass() {
  //$this->a = -1;
  echo $this->a;
 }
}
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-07 03:58 UTC] moriyoshi@php.net
I got the correct result (-1) with the supplied script..
 [2003-05-07 04:24 UTC] wima at tiscali dot ch
Hm... I ever get 0. This is a mysteriously Bug...
 [2003-05-07 05:56 UTC] wez@php.net
Already fixed in CVS; try a snapshot from http://snaps.php.net
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC