• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Zend_Filter help required please


Active member
Using Robbo's xfgamer45's Ad Manager is fine on PHP 5.3, however 5.4 and above it throws a depreciated /e modifier error, just like in this old bug report

The full error text is :

An exception occurred: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /Volumes/Data/127/xendev/library/Zend/Filter/PregReplace.php on line 171

  1. XenForo_Application::handlePhpError()
  2. preg_replace() in Zend/Filter/PregReplace.php at line 171
  3. Zend_Filter_PregReplace->filter() in Zend/Filter/Word/SeparatorToCamelCase.php at line 49
  4. Zend_Filter_Word_SeparatorToCamelCase->filter() in Zend/Filter.php at line 233
  5. Zend_Filter::filterStatic() in Merc/AdManager/Common/Helper.php at line 79
  6. Merc_Common_Helper_Version04::underscoreToCamelCase() in Merc/AdManager/Common/Model.php at line 110
  7. Merc_Common_Model_Version04->__call() in Merc/AdManager/Listener.php at line 71
  8. Merc_AdManager_Model_Position->getPositions() in Merc/AdManager/Listener.php at line 71
  9. Merc_AdManager_Listener->getPositions() in Merc/AdManager/Listener.php at line 55
  10. Merc_AdManager_Listener::frontControllerPreView()
  11. call_user_func_array() in XenForo/CodeEvent.php at line 90
  12. XenForo_CodeEvent::fire() in XenForo/FrontController.php at line 156
  13. XenForo_FrontController->run() in /Volumes/Data/127/xendev/index.php at line 13
If I've done this correctly, it is step 5 that's the issue, the function code is :

public static function underscoreToCamelCase($string, $lowerCaseFirst = false)
            $ret = Zend_Filter::filterStatic($string, 'Word_UnderscoreToCamelCase');
            return $lowerCaseFirst ? lcfirst($ret) : $ret;
It's a long shot, but is this the function that's causing the issue when it calls the relevant part of the Zend Framework? If so, how do I change it to become compliant?

Any ideas? Thanks in advance.

Chris D

XenForo developer
Staff member
I think using regex and a callback to achieve this is overkill.

$string = 'underscore_to_camel_case';
$string = str_replace(' ', '', ucwords(str_replace('_', ' ', $string)));
That would return UnderscoreToCamelCase.

Naturally you can modify the first character accordingly should you need to.