|Anonymous | Login | Signup for a new account||01-25-2021 03:47 PST|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0002539||[Quercus]||minor||always||03-19-08 21:27||03-21-08 13:19|
|Summary||0002539: a zero value Double or Float Value type should return "0" when converted to String|
I ran into a problem with an unexpected behavior when running phpBB3.
There is a code inside phpBB3's includes/db/mysqli.php that does a float-based division. A floor() is then applied to it. The return value of a floor() is a float value, which is expected and is the proper behavior that Quercus exhibits.
However, the problem is that the floor'ed value is appended to a SQL query string for the "limit x, y" part of the query. Unfortunately, the toString() for the float value of 0 returned "0.0" when run under quercus. This turned the limit string into "limit 0.0, 10", which mysql driver throws an exception.
I recommend that the Double and Float and Decimal value types should check for 0, and if so, return "0" for the string instead of "0.0" to retain compatible behavior with PHP.
|What Quercus version are you using? I remember this issue being fixed for 3.1.4 or 3.1.5. You might want to give 3.1.5 a try.|
edited on: 03-20-08 20:06
Running the latest quercus version compiled straight off the SVN that's checked out as of today. Revision 3969.
I did a double confirmation and removed the (int) type conversion in mysqli.php in phpbb3. The line is originally this:
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
Running it with the newest SVN snapshot still gives me the error. By adding this a forced type conversion:
$query .= "\n LIMIT " . ((!empty($offset)) ? (int) $offset . ', ' . $total : $total);
Things worked after that. Previously, I was using 3.1.5. And before that I was using the version that came with Resin 3.1.5.
issue only seen if the float is on the left hand side of an append ('.')
i.e. var_dump(10.0 . ", 10")
|03-19-08 21:27||ckchris||New Issue|
|03-19-08 21:28||ckchris||Issue Monitored: ckchris|
|03-20-08 19:36||nam||Note Added: 0002871|
|03-20-08 20:05||ckchris||Note Added: 0002873|
|03-20-08 20:06||ckchris||Note Edited: 0002873|
|03-20-08 21:23||nam||Status||new => assigned|
|03-20-08 21:23||nam||Assigned To||=> nam|
|03-21-08 13:19||nam||Status||assigned => closed|
|03-21-08 13:19||nam||Note Added: 0002875|
|03-21-08 13:19||nam||Resolution||open => fixed|
|03-21-08 13:19||nam||Fixed in Version||=> 3.1.6|
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
35 total queries executed.|
28 unique queries executed.