php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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 :

<?php

class TestNeg {
	var $v = -10;
}

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

?>

outputs '0' instead of '-10'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

 [2003-04-29 10:37 UTC] wez@php.net
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.
<?php
function test($var = -1)
{
	echo $var;
}
test();
?>
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 snaps.php.net and the problem has been fixed.yeah,not bug now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 22:01:30 2024 UTC