php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3864 EREG(i) uses 30-50% cpu
Submitted: 2000-03-18 00:17 UTC Modified: 2000-04-01 23:38 UTC
From: kevin at nsane dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.14 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kevin at nsane dot net
New email:
PHP Version: OS:

 

 [2000-03-18 00:17 UTC] kevin at nsane dot net
<pre>
$exp = "<tr><td><a href=\"(.*)\">(.*)</a></td><td align=\"center\">(.*)</td><td>(.*)</td><td align=right><b>(.*)</b></td><td>(.*)</td><td><A HREF=\"(.*)\">(.*)</A></td></tr>";

$af = fopen("http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll?MfcISAPICommand=ViewListedItems&userid=johannah@ccssinc.com&include=0&since=-1&sort=2&rows=50","r");
while (!$end)
{
$line = fgets($af, 2048);
$content .= $line;
$end = feof($af);
}
fclose($af); 

if (ereg($exp,$content,$reg)) {
	echo $reg[2] . "\n";
}
</pre>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-18 10:48 UTC] kevin at nsane dot net
I just caved and used preg_match_all. Interestingly enough preg uses 0.1% for the same expression. Hmm...
 [2000-04-01 23:38 UTC] sas at cvs dot php dot net
Yep, the ereg stuff is very slow. That is due to the implementation, unfortunately it is not easy to fix that.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Jun 29 07:00:01 2026 UTC