Bug #15220 Updated: unserialize() failed at offset X of X bytes
| From: | jfl at eksperten dot dk | Date: | Fri, 01 Feb 2002 12:55:08 +0000 |
| Subject: | Bug #15220 Updated: unserialize() failed at offset X of X bytes | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-78765@lists.php.net to get a copy of this message | ||
ID: 15220
Comment by: jfl@eksperten.dk
Reported By: jfl@eksperten.dk
Status: Feedback
Bug Type: Unknown/Other Function
Operating System: Linux
PHP Version: 4.1.1
New Comment:
So sorry, the bug was in my db settings.
Sorry I wasted your time !
Previous Comments:
------------------------------------------------------------------------
[2002-01-25 15:21:14] sander@php.net
I ran the two following scripts, to generate 100MB of random data, and
pass it through serialize/unserialize. diff told me both output files
were exactly the same.
<?php
$max = 1024*1024*100;
$f = fopen("./rnd-data", "w");
for($i=0; $i<$max; $i++) {
fputs($f, chr(rand(0,255)));
}
fclose($f);
?>
<?php
$f = fopen('./rnd-data', 'r');
$data = fread($f, 1024*1024*100+1);
fclose($f);
$f = fopen('./rnd-output', 'w');
fputs($f, unserialize(serialize($data)));
fclose($f);
?>
Are you sure the data gets stored and retrieved correctly?
(btw tested with 4.1.1 on Debian (Sid) Linux)
------------------------------------------------------------------------
[2002-01-25 12:47:28] jfl@eksperten.dk
I use this script :
<?
require($_SERVER["DOCUMENT_ROOT"]."/lib/db.phtml");
function error_control ($errno, $errstr, $errfile, $errline) {
$errortype = array (
1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024 => "User Notice"
);
//
print("<BR>".$errortype[intval($errno)]." :
".$errstr."<BR>File :
".$errfile."<BR>Line : ".$errline);
}
error_reporting(E_ALL);
$error_handler = set_error_handler("error_control");
print("<TABLE BORDER=\"1\">\n");
$SQL = "SELECT id, error_data FROM unserialize";
$RS = mysql_query($SQL, db_conn);
while ($RSarray = mysql_fetch_row($RS)) {
unserialize($RSarray[1]);
print("<TR>");
print("<TD>".$RSarray[0]."</TD>");
print("<TD>".$RSarray[1]."</TD>");
print("</TR>\n");
}
print("</TABLE>\n");
?>
------------------------------------------------------------------------
[2002-01-25 12:38:42] jfl@eksperten.dk
I can provide the data that failed here :
http://www.eksperten.dk/bug.phtml
Is that ok, otherwise let me know !
------------------------------------------------------------------------
[2002-01-25 11:54:03] sander@php.net
Can you supply some (malicious) sample data (in- and output of
(un)serialize) along with a simple samplescript?
------------------------------------------------------------------------
[2002-01-25 05:36:03] jfl@eksperten.dk
I use this @ www.eksperten.dk
Let me know if I can help with anything !
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=15220
Edit this bug report at http://bugs.php.net/?id=15220&edit=1