Various PHP 5.3 deprecated code fixesPosted by Matt Thommes on October 7, 2009 | Post type: Gain With the release of PHP 5.3 have come many necessary code changes due to deprecated warnings. This is intended to be a running tally of changes that should be made to specific code syntax, in order to avoid PHP warnings in your applications. This is, by no means, a complete list, but as I hear about them, I will continue to add them to this post. ereg_replaceCode sample
What the script is trying to doPerform a pattern match, then replace. Warning that you'll get
What needs to be done to fix itSince we're using a simplified regular expression in this example ( This:
... should become:
Code sample
What the script is trying to doPerform a regular expression pattern match, then replace. In this case, we're replacing all URL's with HTML hyperlinks. Warning that you'll get
What needs to be done to fix it
Assigning by referenceCode sample
What the script is trying to doAssign the return value of Warning that you'll get
What needs to be done to fix itThis:
... should become: unset($a); $a = new $func($param1, $param2); Code sample
What the script is trying to doAssign the return value of Warning that you'll get
What needs to be done to fix itThis:
... should become: $this->files['error'] = null; $this->files['error'] = new HTTP_Upload_File( ... session_unregisterCode sample
What the script is trying to doUnset a session variable. Warning that you'll get
What needs to be done to fix itThis:
... should become:
About the author(s)Matt Thommes is an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from a suburb of Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us. Comments
|
Quick Link to this postTTIP.me/2221 |
Great article. So many people gives workarounds but no one create an article contain collection fixes like you do. Thanks Matt. Btw I am from Indonesia.
Quick Link to this comment: http://TTIP.me/c5420