Re: Crach with pear remote-list
| From: | Stig S. Bakken | Date: | Tue, 21 May 2002 14:21:42 +0000 |
| Subject: | Re: Crach with pear remote-list | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6282@lists.php.net to get a copy of this message | ||
On Tue, 2002-05-21 at 13:05, Tomas V.V.Cox wrote:
> While playing with "pear remote-list" I'm getting PHP segfaults. The
> problem (reproduceable) is comming from a ereg("^.*\r\n\r\n", $data,
> $foo) when $data is a large string (for ex a 53Kb XML_RPC response).
> preg_match_all("|^.*\r\n\r\n|s") and ereg_replace() dumps core too.
>
> A quick patch to XML_RPC/RPC.php is here:
> $ diff -Bbu ~/temp/download/repo_pear/pear/XML_RPC/RPC.php RPC.php
> --- /root/temp/download/repo_pear/pear/XML_RPC/RPC.php Tue May 21
> 12:57:51 2002+++ RPC.php Tue May 21 12:56:36 2002
> @@ -639,9 +640,11 @@
> xml_parser_free($parser);
> return $r;
> }
> // gotta get rid of headers here
> - if ((!$hdrfnd) &&
> ereg("^(.*)\r\n\r\n",$data,$XML_RPC_xh[$parser]['ha'])) {
> - $data=ereg_replace("^.*\r\n\r\n", "", $data);
> + $first = substr($data, 0, 1024);
> + if ((!$hdrfnd) &&
> ereg("^(.*)\r\n\r\n",$first,$XML_RPC_xh[$parser]['ha'])) {
> + $data=preg_replace("|^.*\r\n\r\n|Us", "", $data);
> $hdrfnd=1;
> }
>
> Any poblems if I commit it?
I'd rather try fixing the segfault.
- Stig