#48840 [NEW]: serialized object: data loss in some use case
| From: | schindler dot andor at pokhalo dot hu | Date: | Tue, 07 Jul 2009 19:45:36 +0000 |
| Subject: | #48840 [NEW]: serialized object: data loss in some use case | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-139440@lists.php.net to get a copy of this message | ||
From: schindler dot andor at pokhalo dot hu
Operating system: any
PHP version: 5.2.10
PHP Bug Type: Class/Object related
Bug description: serialized object: data loss in some use case
Description:
------------
If i serialize a PHP object, then become some \0 characters in property's
field name. This cause some problems, where others using char* instead of
smart_str.
Example: If i try escape a serialized object's string with
pg_escape_string() then i give a truncated string, because the
PQescapeStringConn()/PQescapeString() terminate the processing at the \0
character.
Reproduce code:
---------------
class aClass
{
private $a;
public function __construct()
{
$this->a = 1;
}
}
$obj = new aClass();
$str = serialize($obj);
// gives: 'O:6:"aClass":1:{s:9:"#aClass#a";i:1;}'
// (i marked \0's places with a #)
echo $str;
$conn = pg_connect('...');
// gives: 'O:6:"aClass":1:{s:9:"'
echo pg_escape_string($conn, $str);
Expected result:
----------------
I think it would be better, if the serialize don't give \0. I think, it's
can not be problem, if serialize uses # or anything instead of \0.
Actual result:
--------------
See code.
--
Edit bug report at http://bugs.php.net/?id=48840&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48840&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48840&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48840&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48840&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48840&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48840&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48840&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48840&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48840&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48840&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48840&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48840&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48840&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48840&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48840&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48840&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48840&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48840&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48840&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48840&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48840&r=mysqlcfg