Development

Changeset 19468

You must first sign up to be able to contribute.

Changeset 19468

Show
Ignore:
Timestamp:
06/23/09 09:14:37 (8 months ago)
Author:
fabien
Message:

[1.2, 1.3] fixed routing for PHP 5.3.0RC4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/lib/routing/sfRoute.class.php

    r17382 r19468  
    650650    $this->options['variable_prefix_regex']    = '(?:'.implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $this->options['variable_prefixes'])).')'; 
    651651    $this->options['segment_separators_regex'] = '(?:'.implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $this->options['segment_separators'])).')'; 
    652     $this->options['variable_content_regex']   = '[^'.implode('', array_map(create_function('$a', 'return str_replace(\'-\', \'\-\', preg_quote($a, \'#\'));'), $this->options['segment_separators'])).']+'; 
     652 
     653    // as of PHP 5.3.0, preg_quote automatically quotes dashes "-" (see http://bugs.php.net/bug.php?id=47229) 
     654    $this->options['variable_content_regex'] = '[^'.implode('', array_map( 
     655      version_compare(PHP_VERSION, '5.3.0RC4', '>=') ? 
     656        create_function('$a', 'return preg_quote($a, \'#\');') : 
     657        create_function('$a', 'return str_replace(\'-\', \'\-\', preg_quote($a, \'#\'));') 
     658      , $this->options['segment_separators'])).']+'; 
    653659  } 
    654660 
     
    755761  { 
    756762    $length = strlen($this->pattern); 
    757      
     763 
    758764    if ($length > 0 && '/' == $this->pattern[$length - 1]) 
    759765    { 
  • branches/1.3/lib/routing/sfRoute.class.php

    r17403 r19468  
    650650    $this->options['variable_prefix_regex']    = '(?:'.implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $this->options['variable_prefixes'])).')'; 
    651651    $this->options['segment_separators_regex'] = '(?:'.implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $this->options['segment_separators'])).')'; 
    652     $this->options['variable_content_regex']   = '[^'.implode('', array_map(create_function('$a', 'return str_replace(\'-\', \'\-\', preg_quote($a, \'#\'));'), $this->options['segment_separators'])).']+'; 
     652 
     653    // as of PHP 5.3.0, preg_quote automatically quotes dashes "-" (see http://bugs.php.net/bug.php?id=47229) 
     654    $this->options['variable_content_regex'] = '[^'.implode('', array_map( 
     655      version_compare(PHP_VERSION, '5.3.0RC4', '>=') ? 
     656        create_function('$a', 'return preg_quote($a, \'#\');') : 
     657        create_function('$a', 'return str_replace(\'-\', \'\-\', preg_quote($a, \'#\'));') 
     658      , $this->options['segment_separators'])).']+'; 
    653659  } 
    654660 
     
    755761  { 
    756762    $length = strlen($this->pattern); 
    757      
     763 
    758764    if ($length > 0 && '/' == $this->pattern[$length - 1]) 
    759765    { 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.