merged branch Tatsh/master (PR #7624)

This PR was submitted for the master branch but it was merged into the 2.1 branch instead (closes #7624).

Discussion
----------

[FrameworkBundle] RegisterKernelListenersPass: Removed and replaced use of deprecated preg_match() /e modifier with regards to PHP 5.5

More information: https://wiki.php.net/rfc/remove_preg_replace_eval_modifier

As of beta 2 of PHP 5.5, the above is implemented. Attempting to run the current version of Symfony FrameworkBundle (or 2.1) will cause an `ErrorException`.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

c1e98b9 The /e modifier for preg_replace() is deprecated in PHP 5.5; replace with preg_replace_callback()
This commit is contained in:
Fabien Potencier 2013-04-11 08:41:27 +02:00
commit fb83589661
1 changed files with 5 additions and 4 deletions

View File

@ -33,10 +33,11 @@ class RegisterKernelListenersPass implements CompilerPassInterface
}
if (!isset($event['method'])) {
$event['method'] = 'on'.preg_replace(array(
'/(?<=\b)[a-z]/ie',
'/[^a-z0-9]/i'
), array('strtoupper("\\0")', ''), $event['event']);
$event['method'] = 'on'.preg_replace_callback(array(
'/(?<=\b)[a-z]/i',
'/[^a-z0-9]/i',
), function ($matches) { return strtoupper($matches[0]); }, $event['event']);
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
}
$definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));