Login   Register  
PHP Classes
elePHPant
Icontem

Deprecated PHP functions are used in code

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Barcode Generator  >  All threads  >  Deprecated PHP functions are used in code  >  (Un) Subscribe thread alerts  
Subject:Deprecated PHP functions are used in code
Summary:Function ereg_replace is deprecated, instead use preg_replace
Messages:3
Author:Nils
Date:2011-08-05 10:44:45
Update:2013-10-25 13:26:03
 

  1. Deprecated PHP functions are used in code   Reply   Report abuse  
Picture of Nils
Nils
2011-08-05 10:44:45
If you encounter PHP error "Function ereg_replace() is deprecated", you can fix that. There are many places, where ereg_replace is used in classes, but in new PHP version, it is deprecated, instead, you should change from ereg_replace to preg_replace function. Example follows.

In code:

ereg_replace(chr(128),'',$this->text);

Should be replaced with:

preg_replace('/'.chr(128).'/','',$this->text);

  2. Re: Deprecated PHP functions are used in code   Reply   Report abuse  
Picture of Elliot Laffey
Elliot Laffey
2011-12-06 18:32:39 - In reply to message 1 from Nils
Thank you for posting this! I found it in the code128 class. Saved me some debugging time.

  3. Re: Deprecated PHP functions are used in code   Reply   Report abuse  
Picture of kirk
kirk
2013-10-25 13:26:03 - In reply to message 1 from Nils
I also want to thank you for posting this. I downloaded the package and was testing several of the barcode formats. I could not get code 128 to display an image. Changing ereg_replace to preg_replace solved the problem.

code128.barcode.php was the only php file containing ereg_repalce.