ID:               25674
 Updated by:       [EMAIL PROTECTED]
 Reported By:      lew at mailduct dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: FreeBSD 4.8-REL
 PHP Version:      4.3.3
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

See bug #20548



Previous Comments:
------------------------------------------------------------------------

[2003-09-26 15:38:34] lew at mailduct dot com

Description:
------------
There is a gross inconsistency between how the increment and decrement
operators function.  If you increment an empty variable, the operations
works correctly.  However, if you *decrement* an empty variable, the
operation leaves it unchanged!  See for yourself, with my clear
example...

Reproduce code:
---------------
<?php

//  Increment some blank/empty variables...
$pos++; $pos++; $pos++;
$neg--; $neg--; $neg--;
//  Show them to us now...
print( "pos = $pos\n" );
print( "neg = $neg\n" );

//  Now do it another way (forced typecast)...
$ppp += 1; $ppp += 1; $ppp += 1;
$nnn -= 1; $nnn -= 1; $nnn -= 1;
//  Show them to us now...
print( "ppp = $ppp\n" );
print( "nnn = $nnn\n" );

#
#  Expected:
#    pos = 3    ppp = 3
#    neg = -3   nnn = -3
#
#  Actual:
#    pos = 3    ppp = 3
#    neg =      nnn = -3
?>


Expected result:
----------------
#
#  Expected:
#    pos = 3    ppp = 3
#    neg = -3   nnn = -3


Actual result:
--------------
#
#  Actual:
#    pos = 3    ppp = 3
#    neg =      nnn = -3

(note that $neg-- fails!)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25674&edit=1

Reply via email to