Jump to content

praotes

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by praotes

  1. Dear Colleagues: 

     

    We have upgraded our server to php5.5 and experience the following, as we run the Smarty template: 

     

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in xxx/xxxx/php5/smarty/base/Smarty_Compiler.class.php on line 270 

     

    The code as it currently is reads this... 

     

    /* replace special blocks by "{php}" */ 

    $source_content = preg_replace($search.'e', "'" 

    . $this->_quote_replace($this->left_delimiter) . 'php' 

    . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" 

    . $this->_quote_replace($this->right_delimiter) 

    . "'" 

    , $source_content); 

     

    QUESTION: Can you please explain what I need to change. The code directly below is identical to the one above, EXCEPT I replaced preg_replace with preg_replace_callback. The php5.5 instructions say I need to replace the "replacement" param with specifying a "callback." I know too little of php to do this, nor do I find a clear cut "replacement" param in this code. 

     

    $source_content = preg_replace_callback($search.'e', "'" 

    . $this->_quote_replace($this->left_delimiter) . 'php' 

    . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" 

    . $this->_quote_replace($this->right_delimiter) 

    . "'" 

    , $source_content);

     

    Hope you can assist. Thanks! 

     

    Hans

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.