#44629 [NEW]: SQLite3 strings don't accept \0 while PHP ones do it
| From: | lapo at lapo dot it | Date: | Thu, 03 Apr 2008 14:13:31 +0000 |
| Subject: | #44629 [NEW]: SQLite3 strings don't accept \0 while PHP ones do it | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-123928@lists.php.net to get a copy of this message | ||
From: lapo at lapo dot it
Operating system: *
PHP version: 5.2.5
PHP Bug Type: PDO related
Bug description: SQLite3 strings don't accept \0 while PHP ones do it
Description:
------------
While PHP strings support \0s in them, SQLite3 doesn't accept them in text
fields, only in blob fields.
A possible work-around, thanks to the closed bug #41135, is to write to a
memory stream and use PDO::PARAM_LOB, but that seems a bit overkill for
very small "string" values such as the binary form of PHP's sha1().
I think the best solution could be to scan a PDO::PARAM_STR value for
zeros and in that case use sqlite3_bind_blob just as if it was a
PDO::PARAM_LOB.
Or maybe (a little cleaner) create a (non-large) PDO::PARAM_BINARY. Using
streams is certainly the best approach for LOB, but I think it's overkill
for non-large-OBs.
Tell me what of the two solutions the PHP team would prefer to adopt and I
can eventually produce a patch.
--
Edit bug report at http://bugs.php.net/?id=44629&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44629&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44629&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44629&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44629&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44629&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44629&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44629&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44629&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44629&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44629&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44629&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44629&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44629&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44629&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44629&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44629&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44629&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44629&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44629&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44629&r=mysqlcfg