Convert deprecated POSIX functions into wrappers for equivalent PCRE functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The POSIX regex functions are currently marked as DEPRECATED in 5.3.0 and 
are due to be removed completely in PHP 6. I propose that instead of being 
dropped they be converted into wrappers for the equivalent PCRE functions.



It does not matter how long various people have been preaching in various 
unofficial channels that users should switch to using the PCRE functions 
(preg_*) instead of the POSIX ones (ereg_*) as many users simply do not 
access those channels. The first time that a significant number of users 
will become aware of this is when they switch to 5.3.0 or later, and they 
will be very, very upset. Some users do not test their applications against 
each new PHP version as it comes out, they just use whatever version their 
hosting company provides them with.



It does not matter that the PHP developers cannot find someone to upgrade 
the POSIX functions, it does not matter that the same functionality can be 
provided with the PCRE functions, all the users will know is that their 
scripts, some of which have been running for many years, will suddenly not 
work and will need serious programming effort before they can run again.



You know how long it took for sites to upgrade from PHP 4 to 5 because of 
the backward compatibility issues, so imagine even more resistance and a 
slower uptake for PHP 6. The POSIX functions have been a core part of the 
language since the early days of PHP, so to suddenly dump them for no good 
reason will alienate and upset a large number of people. When I say "no good 
reason" I mean from the user's point of view. The fact that it is taking 
(has taken?) considerable effort to get the PCRE functions working with 
Unicode for PHP 6, and no-one is prepared to spend similar effort on the 
POSIX functions, may make it seem in the users eyes that the PHP developers 
are either lazy or incompetent.



It does not matter that the PHP developers are unpaid volunteers - that is 
no reason for shoddy workmanship. If they can't do the job properly they 
shouldn't do it at all. BC breaks, especially on a range of functions which 
have been a core part of the language for many, many years, do not go down 
well with the users, and remember that it is the incredibly large number of 
people who use PHP, not the efforts of the developers, that has made it such 
a popular language. So annoying large numbers of users will create a PR 
disaster.



If the PCRE functions have been made to work with Unicode, and each of the 
POSIX functions has a PCRE equivalent, then surely an intelligent move would 
be to convert all the POSIX functions into simple wrappers for their PCRE 
equivalents. So instead of spending huge amounts of effort in making the 
POSIX functions work with Unicode you simply cut out the code behind each 
POSIX function and replace it to a call to the relevant PCRE function.



This should only require a relatively small amount of developer effort which 
should be balanced against the huge amount that would otherwise be required 
in userland. If the PHP developers are not prepared to undertake this small 
amount of effort then they should be prepared for considerable amounts of 
fallout from lots of unhappy users.



I would strongly suggest that a start be made on this as soon as possible so 
that the changeover to PCRE wrappers can be fully tested and debugged before 
PHP 6 goes live. This will make the changeover from POSIX to PCRE totally 
transparent, and will be greatly appreciated in userland.


-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux