php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9451 Core maths problem with incrementation
Submitted: 2001-02-26 02:07 UTC Modified: 2001-03-15 09:16 UTC
From: alex at sgl dot net dot au Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.4pl1 OS: Linux Redhat 6.0 (server)
Private report: No CVE-ID: None
 [2001-02-26 02:07 UTC] alex at sgl dot net dot au
I wrote a poll section for the company i work for, on www.sgl.net.au.
I was testing boundary and illegal values with my script, and i set the number of votes for one of the options to
-1, when i click "Vote" it takes the -1 and increments it. (taken from a mysql_db) when it finishes incrementing it the resulting vote number is -2

so 
$variable = - 1;
$variable++;


echo $variable prints out -2
The problem could be with mysql returning a positve integer only ,but i thought i'd mention it anyway

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-15 09:16 UTC] stas@php.net
You are working with $variable as a string. Convert it to
integer with (int) or with adding 0 to it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC