Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in

Versi PHP yang digunakan : 

(TirtaERP) php --version
PHP 5.5.3-1ubuntu2.2 (cli) (built: Feb 28 2014 20:03:35) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies


Warning yang muncul : 

(TirtaERP) ./symfony help tirtaerp:receipt
PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wildan/jobstuff/OpenThinkLabs/Pelanggan/TirtaMurni/webapps/TirtaERP/lib/vendor/symfony/lib/task/sfTask.class.php on line 307

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wildan/jobstuff/OpenThinkLabs/Pelanggan/TirtaMurni/webapps/TirtaERP/lib/vendor/symfony/lib/task/sfTask.class.php on line 307
Usage:
 symfony tirtaerp:receipt [--connection="..."] [--payment="..."] [--sf_request="..."] 

Options:
 --connection  Koneksi database yang ingin digunakan (default: doctrine_batch)
 --payment     sfRequest (default: cash)
 --sf_request  sfRequest (default: )

Description:
               
                 ./symfony tirtaerp:receipt. Melakukan pelunasan baik kredit (credit) maupun tunai (cash).
 

Untuk mengatasi masalah ini, ubah : 

 public function getDetailedDescription()
  {
    return preg_replace('/\[(.+?)\|(\w+)\]/se', '$this->formatter->format("$1", "$2")', $this->detailedDescription);
  }

Menjadi : 

 public function getDetailedDescription()
  {
    $formatter = $this->getFormatter();
    return preg_replace_callback('/\[(.+?)\|(\w+)\]/s', function ($match) use ($formatter) {
      return $formatter->format($match['1'], $match['2']);
    }, $this->detailedDescription);
  }


Comments