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
 [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

Pull Requests

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: Thu Dec 26 14:01:30 2024 UTC