I'm installing TimeTrex Open Source here in Brazil. We use Apache 2.2 and PHP 5.3.1
I'm having problems during installation beacuse Profiler.class.php (line 193) uses split() function, that is deprecated.
Fixing the problem is easy*, but my difficulty is in making this correction throughout all the project. These errors will probably appear over time in other files in the project, not only in the installation process, so it is very difficult do corrections in a large group of files, without the risk of making mistakes or harm the project.
Thus, this task is simple for anyone who already knows the project, since it involves only small replacements.
PHP.net tip:
* In the article above, the author explains how to solve the problem in a simple and elegant waypreg_split(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to split(). If you don't require the power of regular expressions, it is faster to use explode(), which doesn't incur the overhead of the regular expression engine.
http://devthought.com/tumble/2009/06/fi ... in-php-53/
Here is some examples:
To migrate split() :
Code: Select all
split('[()]', $string);
Code: Select all
preg_split('/[()]/', $string);
To migrate ereg() :
Code: Select all
ereg('\.([^\.]*$)', $this->file_src_name, $extension);
Code: Select all
preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
Notice that I wrapped the pattern (\.([^\.]*$)) around / /, which are RegExp delimiters. If you find yourself escaping / too much (for an URL for example), you might want to use the # delimiter instead.
To migrate ereg_replace() :
Code: Select all
$this->file_dst_name_body = ereg_replace('[^A-Za-z0-9_]', '', $this->file_dst_name_body);
Code: Select all
$this->file_dst_name_body = preg_replace('/[^A-Za-z0-9_]/', '', $this->file_dst_name_body);
Again, I just added delimiters to the pattern.
If you are using eregi functions (which are the case-insensitive version of ereg), you’ll notice there’re no equivalent pregi functions. This is because this functionality is handled by RegExp modifiers.
Basically, to make the pattern match characters in a case-insensitive way, append i after the delimiter:
Code: Select all
eregi('\.([^\.]*$)', $this->file_src_name, $extension);
Code: Select all
preg_match('/\.([^\.]*$)/i', $this->file_src_name, $extension);
If any member has a broader knowledge of the project and knows where these functions may appear, their aid will be of great value to the community and for the project, with just a few replacements.
Thank you!