Hi.
I'm getting a crash with the new Win32 Snapshot - PHP 5.2.0RC2-dev
(cli) (built: Aug 9 2006 08:20:48) / PHP Version 5.2.0RC2-dev Build
Date Aug 9 2006 08:15:12 (for ISAPI)
(From DrWatson for CLI)
AppName: php.exe AppVer: 5.2.0.0 ModName: php5ts.dll
ModVer: 5.2.0.0 Offset: 00009f78
(From Browser for ISAPI)
PHP has encountered an Access Violation at 00F19F78
Using Depends.exe, that address is closest to _zend_mm_free (0x9D30)
and _zend_mm_realloc (0xA030)
These functions follow each other in zend_alloc.c.
The userland code was working before I upgraded the snapshot.
I've done all the usual stuff like removing extensions and Zend
Optimizer. I'm having the problem with the CLI and ISAPI versions.
What can I do to identify the problem further.
The script which causes the problem is quite large. I'm not able to
reproduce a simple case for the problem.
Is there a debug version available for PHP and if so, what debugger
should I use?
The actual line of code for which the script fails is trivial (the
echos are debugs I've added to find the problem) ...
// Works.
$headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF,
$this->headers)));
echo "\n\n" , FILE, ' ' , LINE, ' ', strlen($this->body);
// Crashes.
$body = str_replace(CRLF . '.', CRLF . '..', $this->body);
echo "\n\n" , FILE, ' ' , LINE;
If I ...
// Works.
$headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF,
$this->headers)));
echo "\n\n" , FILE, ' ' , LINE, ' ', strlen($this->body);
// Works.
$b1 = $this->body;
echo "\n\n" , FILE, ' ' , LINE, ' ', strlen($b1), ' ',
strlen($this->body);
// Crashes.
$body = str_replace("\r\n.", "\r\n..", $b1);
echo "\n\n" , FILE, ' ' , LINE;
If I ...
// Works.
$headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF,
$this->headers)));
echo "\n\n" , FILE, ' ' , LINE, ' ', strlen($this->body);
// Works.
$b1 = $this->body;
echo "\n\n" , FILE, ' ' , LINE, ' ', strlen($b1), ' ',
strlen($this->body);
// File saved and then crash.
$b2 = file_put_contents('C:/data.txt', $b1);
// Not reached.
echo "\n\n" , FILE, ' ' , LINE, ' ', var_export($b2, True);
$body = str_replace("\r\n.", "\r\n..", $b1);
echo "\n\n" , FILE, ' ' , LINE;
I looked at the data directly. The data is an HTML email with some CSS
in it. Some of the CSS is like ...
/* Success's have a green background */
.MAction_Success_TH
{
background-color : #00FF00;
}
.MTable_Action_TD
{
background-color : #DFDFDF;
}
.MTitle_Action_TH
{
background-color : #7F7FFF;
}
.MTitle_TH
{
background-color : #007FFF;
}
By putting a space in front of the '.', this has solved the problem. e.g.
/* Success's have a green background */
.MAction_Success_TH
{
background-color : #00FF00;
}
.MTable_Action_TD
{
background-color : #DFDFDF;
}
.MTitle_Action_TH
{
background-color : #7F7FFF;
}
.MTitle_TH
{
background-color : #007FFF;
}
I've NO idea why. Please remember that the code was working BEFORE the
snapshot and I've been stupid and not kept the old version. I will in
future.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"