Bug #68638 [Opn->Csd]: pg_update() fails to store infinite values

From: Date: Sat, 14 Feb 2015 14:23:06 +0000
Subject: Bug #68638 [Opn->Csd]: pg_update() fails to store infinite values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190683@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68638&edit=1 ID: 68638 Updated by: laruence@php.net Reported by: joerg dot ludwig at iserv dot eu Summary: pg_update() fails to store infinite values -Status: Open +Status: Closed Type: Bug Package: PostgreSQL related Operating System: Debian Linux PHP Version: 5.4.36 Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=7667f8efc6ee9727cbd7af26e5f62f9cebd8a25e Log: Fixed bug #68638 (pg_update() fails to store infinite values) Previous Comments: ------------------------------------------------------------------------ [2015-02-04 15:29:55] joerg dot ludwig at iserv dot eu Hi William, thanks for your patch, looks good to me! In the meantime I also discovered, that pg_insert()/pg_update() do not understand IPv6 addresses and database fields of the extended type DEBVERSION. But maybe I should write another bug report for this. ------------------------------------------------------------------------ [2015-02-04 00:24:20] william dot welter at 4linux dot com dot br The problem is that on source code, when a PHP string is passed to a float field on database, this string is checked with a regex that is not aware about "infinity" values. See the the patch that i send. ------------------------------------------------------------------------ [2014-12-23 14:06:34] joerg dot ludwig at iserv dot eu Description: ------------ pg_update() fails to store infinite values. Test script: --------------- $dbh = pg_connect("dbname=test"); pg_update($dbh, "test", ["ping" => INF], ["id" => 42]); pg_update($dbh, "test", ["ping" => "INF"], ["id" => 42]); Expected result: ---------------- pg_update() (and pg_insert()) should be able to store infinite values (INF and -INF). In PostgreSQL itself it works: UPDATE test SET ping = 'INF' WHERE id = 42; Actual result: -------------- PHP Warning: pg_update(): ERROR: column "inf" does not exist LINE 1: UPDATE "test" SET "ping"=INF WHERE "id"=42... ^ in Command line code on line 1 PHP Notice: pg_update(): 'INF' does not match with '^([+-]{0,1}[0-9]+)|([+-]{0,1}[0-9]*[\.][0-9]+)|([+-]{0,1}[0-9]+[\.][0-9]*)$' in Command line code on line 1 PHP Notice: pg_update(): Expects NULL, string, long or double value for PostgreSQL 'float4' (ping) in Command line code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68638&edit=1

« previous php.bugs (#190683) next »