php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #282 decrement operator(--) not working for vars from URL
Submitted: 1998-04-17 12:45 UTC Modified: 1998-04-17 12:59 UTC
From: miko at cnt dot pl Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Release Candidate 3 OS: Linux RH5.0
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: miko at cnt dot pl
New email:
PHP Version: OS:

 

 [1998-04-17 12:45 UTC] miko at cnt dot pl
My setup:
php3.0RC3
linux RH5.0
mysql-3.21.29 (compiled in mysql support)
no php3.ini file - defaults compiled in)

A "--" operator doesn't work when the variable is set in URL
(didn't tested POST method, only GET). At the same time, however,
the "++" operator works.

Script "decrtest.html"
<?
#$a=0;
echo "$a"; $a++; echo "$a"; $a++; echo "$a";
$a--; echo "$a";$a--;echo "$a";
$a++; echo "$a";$a++; echo "$a";
?>

Results:
http://localhost/decrtest.html
121012 (this is OK, the first $a=="" so it's not visible)

http://localhost/decrtest.html?a=5
5677789 (BUG - no decrementing)

After uncommenting #$a=0:
http://localhost/decrtest.html
0121012


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-17 12:59 UTC] zeev
The reason is that $a is set to "5" and not 5 (type string and not integer), and the decrement operator isn't defined for strings (the increment operator is).
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 29 02:05:45 2022 UTC