|  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
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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-10 16:53 UTC]
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: Sat Jul 13 04:01:31 2024 UTC