Bug #72124 [NEW]: pg_convert prefixes UUIDs with escape string constant

From: Date: Thu, 28 Apr 2016 18:43:20 +0000
Subject: Bug #72124 [NEW]: pg_convert prefixes UUIDs with escape string constant
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200817@lists.php.net to get a copy of this message
From:             me at nonrandom dot it
Operating system: Centos 6.7
PHP version:      5.6.21RC1
Package:          PostgreSQL related
Bug Type:         Bug
Bug description:pg_convert prefixes UUIDs with escape string constant

Description:
------------
---
From manual page: http://www.php.net/function.pg-convert
---

Using pg_convert along with pg_query_params and having a value of UUID
among the values being converted generates an error:

Warning:  pg_query_params(): Query failed: ERROR:  invalid input syntax
for uuid: "E'7d9c76e4-0278-11e6-a626-000c2917e56a'"

It would seem that pg_convert is prefixing an escape string constant to
UUIDs, and that is possibly causing the issue.

I was using pg_convert to get around boolean falses becoming empty
strings, but ended up using something else when I ran across this.


Test script:
---------------
CREATE TABLE public.test_uuid(
	id uuid
);

$db = pg_connect('host=localhost port=5432 dbname=public user=postgres
password=1234');

$sql = 'insert into public.test_uuid (id) values ($1)';

$values = array('id' => '7d9c76e4-0278-11e6-a626-000c2917e56a');

pg_covert($db, 'test_uuid', $values);

pg_query_params($db, $sql, $values);


-- 
Edit bug report at https://bugs.php.net/bug.php?id=72124&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72124&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72124&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72124&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72124&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72124&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72124&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72124&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72124&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72124&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72124&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72124&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72124&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72124&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72124&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72124&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72124&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72124&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72124&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72124&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72124&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#200817) next »