php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18399 eregi function causes apache to crash that page
Submitted: 2002-07-17 18:48 UTC Modified: 2002-07-18 02:16 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: peter at 600ml dot com dot au Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: peter at 600ml dot com dot au
New email:
PHP Version: OS:

 

 [2002-07-17 18:48 UTC] peter at 600ml dot com dot au
Use the eregi function on any php page running apache on linux and php version 4.21.

Sorry I cant be more specific about the set-up. My knowledge of linux is limited and I didnt set-up the machine. It does run "Plesk" which is a gui server adminstration thingy.

Apache will spit out the following error: "FATAL:  emalloc():  Unable to allocate -193592 bytes"

The page returned will contain no data. 

Internet explorer 6 will say "Page cannot be displayed".

Netscape 4.* will say "page contains no data".

Netscape 6 will do nothing.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-17 18:52 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2002-07-17 19:27 UTC] peter at 600ml dot com dot au
what you did:
ran a php script on a apache/linux server that ran a million times before perfectly well on the same set-up with a lower version of php

what you expected to happen:
the script to run present me with a page

what happened:
the below browsers spat out the errors as described below

i narrowd down the code and noticed that the apache error message and the resulting "no data" pages occured only if the "eregi" function was present in the script
 [2002-07-17 19:58 UTC] sniper@php.net
Can you please give us a short but complete example
script which we can use to reproduce this?

 [2002-07-17 19:59 UTC] sniper@php.net
And how was PHP configured? (you can find the configure line in phpinfo() output)

 [2002-07-17 20:24 UTC] peter at 600ml dot com dot au
php configuration:
--------------------------------------

'./configure' '--with-apxs=../../psa/apache/bin/apxs' '--prefix=../../psa/apache' '--with-system-regex' '--with-config-file-path=/usr/local/psa/apache/conf' '--disable-debug' '--disable-pear' '--enable-sockets' '--enable-track-vars' '--without-gd' '--with-mysql=../../psa/mysql' '--with-iodbc=../odbcsdk' '--with-imap=../imap-2001a' '--with-pgsql=/usr/local/pgsql'

--------------------------------------

here is a script that will crash the page:
<?php

function detect_browser()
{

	if(eregi("(opera) ([0-9]{1,2}.[0-9]{1,3}){0,1}",$_SERVER['HTTP_USER_AGENT'],$match) || eregi("(opera/)([0-9]{1,2}.[0-9]{1,3}){0,1}",$_SERVER['HTTP_USER_AGENT'],$match)){
		$BName = "Opera"; $BVersion=$match[2];
	}else{
		$BName = "nothing";
	}
	return $BName;
}

$browser = detect_browser();
print $browser;

?>

you can see it in action here:
http://www.600ml.com.au/test2.php
 [2002-07-18 02:16 UTC] edink@php.net
If you recompile php without "--with-system-regex" option  the problem will go away.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 18:00:02 2026 UTC