Skip to content

Commit 30a2fc5

Browse files
committed
Remove(legacy): drop PHP v5.3 check on sfRoute
This removes a preliminary fix for a legacy PHP 5.3. issue with regexp excaping PHP bug reference: http://bugs.php.net/bug.php?id=47229
1 parent 64d9fc0 commit 30a2fc5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/routing/sfRoute.class.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -668,20 +668,14 @@ protected function initializeOptions()
668668
'extra_parameters_as_query_string' => true,
669669
), $this->getDefaultOptions(), $this->options);
670670

671-
$preg_quote_hash = function ($a) { return preg_quote($a, '#'); };
671+
$preg_quote_hash = static function ($a) { return preg_quote($a, '#'); };
672672

673673
// compute some regexes
674674
$this->options['variable_prefix_regex'] = '(?:'.implode('|', array_map($preg_quote_hash, $this->options['variable_prefixes'])).')';
675675

676676
if (count($this->options['segment_separators'])) {
677677
$this->options['segment_separators_regex'] = '(?:'.implode('|', array_map($preg_quote_hash, $this->options['segment_separators'])).')';
678-
679-
// as of PHP 5.3.0, preg_quote automatically quotes dashes "-" (see http://bugs.php.net/bug.php?id=47229)
680-
$preg_quote_hash_53 = function ($a) { return str_replace('-', '\-', preg_quote($a, '#')); };
681-
$this->options['variable_content_regex'] = '[^'.implode(
682-
'',
683-
array_map(version_compare(PHP_VERSION, '5.3.0RC4', '>=') ? $preg_quote_hash : $preg_quote_hash_53, $this->options['segment_separators'])
684-
).']+';
678+
$this->options['variable_content_regex'] = '[^'.implode('', array_map($preg_quote_hash, $this->options['segment_separators'])).']+';
685679
} else {
686680
// use simplified regexes for case where no separators are used
687681
$this->options['segment_separators_regex'] = '()';

0 commit comments

Comments
 (0)