AW: [PEAR-DEV] #24865 [Asn]: [patch] let XML_RSS, XML_Parser accept string inputs
| From: | Stephan Schmidt | Date: | Sat, 23 Aug 2003 10:10:36 +0000 |
| Subject: | AW: [PEAR-DEV] #24865 [Asn]: [patch] let XML_RSS, XML_Parser accept string inputs | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20431@lists.php.net to get a copy of this message | ||
Hi,
I don't think this was a good idea!
The parse() method was changed in a very bad way:
// if $this->fp was fopened previously
if (is_resource($this->fp)) {
// write entire file to $data
while (!feof($this->fp)) {
$data .= fread($this->fp, 2048);
}
fclose($this->fp);
// otherwise, $this->fp must be a string
If you hand over a resource, the whole file is read into memory. Imagine
parsing huge files (100MB and up). This will result in avoidable memory
consumption and even in a fatal error "Memory limit exceeded". There
should NOT be a release including this patch.
I'll work on XML_Parser (need to implement some other features) next
week and supply a patch that enables you to parse strings w/o breaking
BC or resulting in the current problem.
Stephan
> -----Ursprüngliche Nachricht-----
> Von: mj@php.net [mailto:mj@php.net]
> Gesendet: Samstag, 23. August 2003 11:54
> An: pear-dev@lists.php.net
> Betreff: [PEAR-DEV] #24865 [Asn]: [patch] let XML_RSS,
> XML_Parser accept string inputs
>
>
> ID: 24865
> Updated by: mj@php.net
> Reported By: marshall at exclupen dot com
> Status: Assigned
> Bug Type: PEAR related
> PHP Version: Irrelevant
> Assigned To: mj
> New Comment:
>
> I've applied your patches to CVS, but I'm leaving this bug
> report unclosed until we have rolled new releases.
>
> Thanks for your help.
>
>
> Previous Comments:
> --------------------------------------------------------------
> ----------
>
> [2003-07-30 01:37:18] marshall at exclupen dot com
>
> Description:
> ------------
> There is no way to pass a string to XML_Parser, such as a
> cached RSS feed from a database. These diffs modify
> XML_Parser to accept strings in addition to the current URLs
> and existing resources, and XML_RSS to be able to pass a
> string to XML_Parser (backwards-compatibility is maintained
> as far as I can see).
>
> [note: see the original post on pear-dev @
> Ø×6b=Mˆ
> O±;E!šhttp://marc.theaimsgroup.com/?l=pear-dev&m=105935331827366&w=2
]
Reproduce code:
---------------
http://www.exclupen.com/misc/php/pear_patches/XML_Parser.diff
http://www.exclupen.com/misc/php/pear_patches/XML_RSS.diff
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24865&edit=1
--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php