#48924 [Asn->Csd]: int value > PHP_INT_MAX causes "Invalid text representation" in pdo_pgsql
| From: | felipe@php.net | Date: | Thu, 16 Jul 2009 22:57:06 +0000 |
| Subject: | #48924 [Asn->Csd]: int value > PHP_INT_MAX causes "Invalid text representation" in pdo_pgsql | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139844@lists.php.net to get a copy of this message | ||
ID: 48924
Updated by: felipe@php.net
Reported By: mark dot kirkwood at catalyst dot net dot nz
-Status: Assigned
+Status: Closed
Bug Type: PDO related
Operating System: Ubuntu x86 (32 bit)
PHP Version: 5.2CVS-2009-07-14 (CVS)
Assigned To: felipe
New Comment:
Thanks for reporting & testing.
Committed in 5.2, 5.3 and HEAD.
Previous Comments:
------------------------------------------------------------------------
[2009-07-16 08:54:52] mark dot kirkwood at catalyst dot net dot nz
Rechecked at home on a 32 bit os, and confirmed that your patch fixes
the issue. Nice work, and thanks again for a very fast resolution.
------------------------------------------------------------------------
[2009-07-16 01:24:13] mark dot kirkwood at catalyst dot net dot nz
Hmm - if you are getting out of range, then that sounds like your table
has the wrong definition - it should be created by:
CREATE TABLE a (id bigint)
so that 2147483648 can actually be inserted. I can replicate what you
are seeing by creating a with 'id integer'.
Having said that, it looks to me like your patch fixes the problem, but
I only have a 64 bit system here at work, so I'm cheating by doing:
//$id = PHP_INT_MAX + 1;
$id = (float)2147483648;
I'll check on a 32-bit system tonight to be sure and report back.
Thanks for the fast response!
------------------------------------------------------------------------
[2009-07-16 01:07:23] felipe@php.net
Yes, it's 32 bit OS.
I just got an expected error "out of range".
I've commited a patch [1] that remove the trailing zeros, please let me
know if it fixes your case.
About the HEAD version, It currently doesn't contains the fix (the code
which introduced the trailing zeros) for #41698.
[1] http://felipe.ath.cx/diff/bug48924.diff
------------------------------------------------------------------------
[2009-07-15 23:24:17] mark dot kirkwood at catalyst dot net dot nz
Are you using a 32bit os? If you turn on statement logging you should
see an insert that looks like:
INSERT INTO a VALUES('2147483648.000000')
------------------------------------------------------------------------
[2009-07-15 23:14:38] felipe@php.net
I can't reproduce it on PostgreSQL with libpq5 (8.3.7).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/48924
--
Edit this bug report at http://bugs.php.net/?id=48924&edit=1