|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-07 20:41 UTC] jani@php.net
[2009-07-07 21:08 UTC] schindler dot andor at pokhalo dot hu
[2009-07-07 21:26 UTC] rasmus@php.net
[2009-07-07 22:25 UTC] schindler dot andor at pokhalo dot hu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 11:00:02 2025 UTC |
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.