Ereg Functions Deprecated In Php 5.3, Removed In 6.0 TCH -- please complain loudly to the PHP lords...
#1
Posted 15 August 2009 - 07:42 PM
That will break every PHP-based website I've developed over the past 5 years, and I suspect I'm not alone.
I'm hoping some TCH gurus are paying attention and will complain loudly on this issue, because TCH gurus can expect total outrage from PHP users like me when the transition to PHP 5.3 or PHP 6.3 occurs.
The solution seems simple. Just tell the PHP language developers to keep the ereg family in the codebase, but state explicitly that no further development or bug fixes will be done on those functions.
Thanks,
Chris Butler
#2
Posted 16 August 2009 - 01:03 AM
Identify where you use ereg functions, start making it habit in new development projects to stop using it and over time back track older code and replace it. At the end the day, php developers are just trying to do what they feel is right for the community at large, which as a matter of preference most agree perl regexp is far superior than maintaining a stand alone regexp implementation.
Ryan MacDonald
Data Center Manager | TotalChoice Hosting, L.L.C.
http://www.totalchoicehosting.com | ryan@totalchoicehosting.com
#3
Posted 16 August 2009 - 06:07 AM
#4
Posted 16 August 2009 - 07:14 AM
Oh and please learn what deprecated means. Here's what it says on php.net/ereg
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.
"DEPRECATED as of PHP 5.3.0" not removed. This means they are planning on removing it and so you will get a warning that the function is deprecated if you use it but, and this is the important part, IT WILL STILL WORK. As web developers it is up to us to keep up with the latest functions, changes, ideas and PHP will give you a warning when something has become deprecated so you have time to learn what it has been replaced with or a better way of doing it.
This post has been edited by carbonize: 16 August 2009 - 07:15 AM
Lazarus Guestbook
A SPADE IS A SPADE - I'm here to help people not to win friends or gain popularity.
#5
Posted 20 August 2009 - 06:20 PM
All my websites have most PHP error reporting options enabled, because I want to know when a problem arises. When 5.3 hits, I suspect I'll have to turn some PHP error reporting bits to keep "deprecated" messages from squirreling client websites. Not a major effort, but it would be nice if 5.3 included a bit or a function to specifically turn off ereg deprecation warnings while leaving other warnings enabled. Fat chance...
When PHP 6.0 hits, I'll have no choice to modify every client website I've ever written in PHP. This isn't a simple typing exercise. I'll have to retest everything I've written -- shopping carts, photo galleries, databased catalogs, etc. Anybody who revises code and doesn't retest it, hasn't been in this business long enough.
I figure two weeks to revise and retest, if everything goes well.
Plan B is simply to leave the ereg stuff in the PHP codebase, tell the world it's no longer being supported, and use it at your own risk. Perl-based regular expressions are more capable, but the ereg functions are more POSIX-compliant. What's wrong with keeping both?
I'm a Unix guy at heart, but I appreciate that Microsoft owns a big chunk of the computing universe because they grok "backward compatability". It's why Cobol is still around, and still arguably the world's most portable language.
Maybe I'm naive, but I suspect TCH support staff will be losing some weekends and evenings soon...
Chris Butler
BS/CS 1980
#6
Posted 20 August 2009 - 06:33 PM
Lazarus Guestbook
A SPADE IS A SPADE - I'm here to help people not to win friends or gain popularity.
#7
Posted 19 May 2010 - 04:01 PM
Some folks may be interested in my conversion efforts, after I upgraded to Snow Leopard, which ships with PHP 5.3:
1) I wrote a set of "acme" wrapper functions for the few ereg functions that I use, which map between ereg and preg. I also wrote a PHP script that changes ereg calls to "acme_ereg" calls. A few regular expressions needed hand-tweaks, but that approach seems to work.
2) My home-grown PHP framework used $namespace as part of my effort to deal with the lack of early namespace support in PHP and CSS. PHP 5.3 confiscated that keyword, so I wrote another script to change all my instances of $namespace to $acme_namespace. Again, that approach worked.
3) Ditto for "split()" (deprecated) and "mysql_list_tables()" (deprecated).
4) PHP 5.3 no longer seems to allow <? as a PHP intro tag, requiring <?php. I wrote yet another PHP script to change my existing code, some of which dates back to 2002, when <? was kosher.
Every modified website had to be tested.
This is a trickier than some might expect, because PHP is a just-in-time interpreter/compiler. The tester must actually hit each code path to test it. If you use a conditional "include", your PHP code may not even get a basic syntax parse.
I'm near a happy ending, and wish everybody else good fortune in their conversion efforts.
But to the PHP developers: dohhhhh! The number one rule of successful software development:
Don't break existing code!
My Intel-based MacBook can still run PowerPC code via Rosetta, and Microsoft still supports the (idiotic) A: B: C: drive-naming convention that dates back to CP/M. (See Unix "mount" for the correct solution.)
Deprecate any code you want and don't waste further development/debugging efforts, but leave it in the code tree.
C code I wrote in 1980 still works. Cobol still works. PHP is the only language I've used that punishes early adopters.
Again, thanks to TCH for being realistic. TCH has always been a reliable partner for me.
Cheers,
Chris
This post has been edited by cbutler: 19 May 2010 - 04:05 PM
#8
Posted 19 May 2010 - 04:13 PM
Ryan MacDonald
Data Center Manager | TotalChoice Hosting, L.L.C.
http://www.totalchoicehosting.com | ryan@totalchoicehosting.com
#9
Posted 27 July 2010 - 10:59 AM
PHP 4 is coming to the end of it's life now so there will be no further updates.
PHP 6 in it's present form, has been scrapped due to the complexity of adding unicode support to strings but some of it's features will be back ported to PHP 5.4.
This post has been edited by carbonize: 27 July 2010 - 11:00 AM
Lazarus Guestbook
A SPADE IS A SPADE - I'm here to help people not to win friends or gain popularity.
#10
Posted 06 August 2010 - 09:44 PM
Prior to 5.3, it was alright to omit the link identifier when using the mysql_close()function. I have PHP 5.3 installed on the WAMPSERVER on one of my computers, and I just spent a fun filled hour trying to figure out why a script that works fine on the live site ( on a TCH server
So, if you use mysql_close(), make sure that you use the link identifier for the connection that you want to close, instead of letting it default to the last link opened.
#11
Posted 07 August 2010 - 04:14 AM
Hell at least you used mysql_close unlike some scripts I have seen.
Lazarus Guestbook
A SPADE IS A SPADE - I'm here to help people not to win friends or gain popularity.

Help














