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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: neta at abcb dot it
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 09:01:28 2025 UTC