php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51413 ereg() no longer works as in earlier versions
Submitted: 2010-03-27 17:03 UTC Modified: 2010-03-27 18:01 UTC
From: rprangnell at gmail dot com Assigned:
Status: Wont fix Package: Program Execution
PHP Version: 5.3.2 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-03-27 17:03 UTC] rprangnell at gmail dot com
Description:
------------
PHP scripts that use the ereg() function and which worked properly in earlier versions may no longer work because of a change in the way ereg() deals with function arguments. Namely, ereg() now seems to check the "expected argument" type and throws an error if the argument is of a different type.
I came across this bug on a brand new, clean install of Drupal 6.3 with the Ubercart ecommerce package. With PHP 5.3 running, certain images would not display and multiple warning messages would pop up, each of them detailing the culprit as ereg(). Simply by changing the running PHP version to 5.2.11 cured all problems.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-27 17:14 UTC] rasmus@php.net
-Status: Open +Status: Wont fix
 [2010-03-27 17:14 UTC] rasmus@php.net
Probably part of bringing everything under the same parameter handling code.  
This will have to be fixed in your application.  And they really shouldn't be 
using ereg() anymore anyway.  It is slower and doesn't support Unicode at all.  
All ereg() calls should be replaced with preg_match() calls.  You will notice 
that the call will also throw an E_DEPRECATED warning in 5.3 letting you know you 
should be replacing those calls.
 [2010-03-27 17:52 UTC] rprangnell at gmail dot com
I can well appreciate why this bug is not going to be fixed - after all, the ereg() function is now officially deprecated and should be replaced by the preg_match() function. However, there must be many applications out there that are still using ereg() and which will therefore suddenly break for no apparent reason whenever the companies hosting such applications upgrade to later versions of PHP.
 [2010-03-27 18:01 UTC] rasmus@php.net
It is not for no apparent reason.  It is because they upgraded without reading 
the UPGRADING documentation.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 04:03:37 2021 UTC