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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
40 + 6 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 13:01:31 2024 UTC