|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23403 Negative integer default value becoming zero
Submitted: 2003-04-29 07:03 UTC Modified: 2003-04-29 10:37 UTC
From: php at bicou dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.2RC2 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: php at bicou dot com
New email:
PHP Version: OS:


 [2003-04-29 07:03 UTC] php at bicou dot com
Property with a negative integer default value is not correctly initialized :


class TestNeg {
	var $v = -10;

$tn = new TestNeg;
echo $tn->v;


outputs '0' instead of '-10'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-29 10:34 UTC]
You must have done something wrong, that works just fine
here. Not bug.

 [2003-04-29 10:37 UTC]
Possibly related to #23395, which has just been fixed.
 [2003-05-01 21:52 UTC] yzcai at ustc dot edu
A function with negative integer default value would have the same problem.
function test($var = -1)
	echo $var;
And the output is 0.
not bug?
 [2003-05-01 22:04 UTC] yzcai at ustc dot edu
well,i've got the lastest stable package from and the problem has been fixed.yeah,not bug now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 13:01:27 2024 UTC