|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29395 sqlite_escape_string may return a random string
Submitted: 2004-07-26 21:18 UTC Modified: 2004-07-27 19:35 UTC
From: thecwin at gmail dot com Assigned:
Status: Closed Package: SQLite related
PHP Version: 5CVS-2004-07-26 (dev) OS: XP Home and Slackware Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 + 15 = ?
Subscribe to this entry?

 [2004-07-26 21:18 UTC] thecwin at gmail dot com

If an empty string like "" is passed to a function as an argument which then passes the argument to sqlite_escape_string($arg), the returned value will be random garbage. The returned value may contain words or useless data. It looks like its reading random memory.

Similar to bug 29339, but does *not* work when passing an empty string created in the function from which it is calling sqlite_escape_string

Reproduce code:

This is affected: 
function escapeSimple($str) { 
   return @sqlite_escape_string($str); 
echo escapeSimple(""); 


whereas this is not:
echo sqlite_escape_string("");

Expected result:
It should return/print nothing.

Actual result:
(Possibly) random characters.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-27 13:30 UTC]
Try this quickfix:
 [2004-07-27 19:35 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 07:01:28 2024 UTC