php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38403 unable to quote \0 to sql strings
Submitted: 2006-08-09 21:05 UTC Modified: 2006-08-10 17:18 UTC
From: neta at abcb dot it Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.4 OS: OSX/NetBSD/FreeBSD
Private report: No CVE-ID: None
 [2006-08-09 21:05 UTC] neta at abcb dot it
Description:
------------
Sending TEXT data to PostgreSQL a database, the string gets 
truncated at the first occurrence of \0.

Reproduce code:
---------------
Just try to INSERT "abc\0def" into a TEXT field.

Expected result:
----------------
'abc'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-10 16:53 UTC] tony2001@php.net
Use PDO::quote() to quote binary data before inserting it to the DB.
 [2006-08-10 17:18 UTC] neta at abcb dot it
update: i just realized that libpq's PQescapeString() *cannot* 
handle \0 in the middle of a string.

This is not PDO's fault.

My apologies.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 08:02:42 2024 UTC