php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49594 POSIX regex are important
Submitted: 2009-09-18 19:53 UTC Modified: 2009-10-01 22:05 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jay at phpcourses dot ca Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3.0 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jay at phpcourses dot ca
New email:
PHP Version: OS:

 

 [2009-09-18 19:53 UTC] jay at phpcourses dot ca
Description:
------------
why is PHP deprecating the pervasive, very important POSIX regex support? nearly every script i have ever written and/or taught in the past 8 years uses posix regex, and now it will ALL be useless? my customers will be disappointed and their code won't work. just LEAVE THE POSIX REGEX ALONE.

Reproduce code:
---------------
ereg('posix')

Expected result:
----------------
success

Actual result:
--------------
the single worst mistake php has ever made

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-01 04:44 UTC] a at b dot c dot de
For the past eight years PHP has recommended using the PCRE regex functions. This has been noted on, for example, the manual page for ereg().
 [2009-10-01 14:25 UTC] jay at phpcourses dot ca
recommended?

simply not true

all it ever says is "Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg(). "

plus, posix regex have a life of their own, independent of php

at my engineering firm we use posix regex exclusively

php is making a mistake abandoning parts of its api.

a mistake.
 [2009-10-01 14:29 UTC] pajoye@php.net
The api is still usable as it is emulated by pcre. If you really like to use it for the rest of your life, disable the deprecated warnings and be done with that.
 [2009-10-01 15:03 UTC] jay at phpcourses dot ca
you've missed the point entirely

unlike C and Java etc

php has gone the route of "most of your old scripts will no longer work when you upgrade php"

it's a mistake

there is no point in trying to defend it, it's a known mistake that's made many of us upset

for example, i teach php at a university and at a college, in addition to being a contractor and developing my own sites such as torqueinvoicing.com and we all know it's a mistake
 [2009-10-01 15:16 UTC] pajoye@php.net
You completely ignore the options you have, that's your rights. There is no bug, there is no issue > bogus. If you don't know how to use the error_reporting flags, please read the manual or ask for support in one of the numerous support channels.

Thanks for your understanding.
 [2009-10-01 15:19 UTC] beverloo@php.net
No, you think it's a mistake. In fact, the PCRE library offers more features, (mostly) better performance and is used in other programming languages as well (Java, Javascript, .NET). On top of that, it offers more consistent syntax.

After all, no one is forcing you to upgrade your PHP version. It will remain available throughout the 5.x versions. Just don't update to PHP 6 if it really is a problem. Either way, you've got more than enough time to update any scripts or sites.
 [2009-10-01 16:24 UTC] jay at phpcourses dot ca
you are mistaken again

posix regex are ALSO everywhere!

i have written probably 10000 scripts, i won't be updating them to use your favorite version of regex

you have once again missed the point:

do not throw away support for APIs

YOU keep the regex, and let US choose

that's community-driven, open-source software

trust me on this
 [2009-10-01 17:48 UTC] jay at phpcourses dot ca
i need to talk to someone more senior/experienced

i write 5000 - 10000 php scripts a year, most of which use posix regex

and i don't need a junior telling me "we are not forcing you to upgrade to php 5.3; keep 5.2 forever"

only a newbie would say that

my clients' scripts are on 1000s of servers around the world

php could also remove support for the pow() function, since there are alternative ways of raising numbers to powers, but like the ereg() support, they'd f*ck millions of developer worldwide

in short:
keep ereg() == no problems
scrap ereg() == problems

so why scrap API support?
 [2009-10-01 18:08 UTC] pajoye@php.net
Jay, disable E_DEPRECATED and be happy. Now go back to your usual activities, thanks.
 [2009-10-01 21:25 UTC] jay at phpcourses dot ca
i can't

see, "marked for deprecation" is different than "will no longer be supported in 5.3"

i'm helping php avoid big mistakes
 [2009-10-01 21:25 UTC] jay at phpcourses dot ca
nobody answered the original query

WHY stop supporting parts of the api all of a sudden?

it does NO harm leaving it in, as in ZERO 

it DOES harm taking it out
 [2009-10-01 21:30 UTC] pajoye@php.net
Can you please do your homework prior to post to php.net's bug reports?

Using PHP 5.3.0/svn:

> php -r "error_reporting(E_ALL); ereg('POSIX');"

Deprecated: Function ereg() is deprecated in Command line code on line 1

> php -r "error_reporting(E_ALL ^ E_DEPRECATED); ereg('POSIX', 'foo');"


 [2009-10-01 21:49 UTC] jay at phpcourses dot ca
you first

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
 [2009-10-01 21:56 UTC] pajoye@php.net
It won't be available in php6 because ereg does not work with Unicode. Simple. Has PHP6 been released yet? or is it getting anywhere close to be released? No and no.

And php 5.x still has many years to live, given that you had already almost a decade to be ready and that you get 5 more years or so using error_reporting.... EOD.
 [2009-10-01 21:59 UTC] jay at phpcourses dot ca
then make ereg() work with preg_match()

so our code is not garbage

when php6 comes out, millions of servers get upgraded, and millions of scripts will no longer function.

a mistake

unsubscribe
unsubscribe
unsubscribe
unsubscribe
unsubscribe
unsubscribe
 [2009-10-01 22:03 UTC] rasmus@php.net
We did not write the regex implementation.  We rely on 3rd-party libraries for everything in PHP.  If a POSIX-compatible library that supports Unicode magically appears, we can consider it, but as of right now that does not exist and we are not going to write one.  I doubt any of the other scripting languages are going to do that either.  Python and Ruby both rely on PCRE as well, so we all support the same type of regular expressions.  

The responsible thing for us to do, given the state of regex libraries, is to let users know that Unicode is the future and their current POSIX regular expressions is not going to work in this Unicode world and they need to plan for that.

I am sorry you do not agree with that, but that is the state of things currently.
 [2009-10-01 22:05 UTC] jay at phpcourses dot ca
ok thank you

it's troublesome for many of us, but unavoidable i guess
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC