diff --git a/.gitattributes b/.gitattributes index 282650056..c5f4a467a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,5 +8,5 @@ docker-compose.yml export-ignore phpstan.neon export-ignore phpunit.xml export-ignore -test/ export-ignore +/test/ export-ignore tests/ export-ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..05f2e1ba0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [thePanz] diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2a9dc32c8..e674aff00 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -18,6 +18,8 @@ jobs: matrix: php-version: - "8.2" + - "8.3" + - "8.4" memcached-version: - "1.6" diff --git a/README.md b/README.md index 9cf3d95cc..645635cac 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github. - [DIC](https://github.com/FriendsOfSymfony1/symfony1/wiki/ServiceContainer) - Composer support -- PHP 8.3 support +- PHP 8.4 support - performance boost - new widgets & validators - some tickets fixed from the symfony trac @@ -34,7 +34,7 @@ It runs on *nix and Windows platforms*. Requirements ------------ -PHP 5.3.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites +PHP 7.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites Installation ------------ diff --git a/docker-compose.yml b/docker-compose.yml index c9177dc32..b238f99a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,6 +45,21 @@ services: - db - memcached + php83: + <<: *services_php82 + build: + args: + PHP_VERSION: '8.3' + MEMCACHE_VERSION: '8.2' + APCU_VERSION: '5.1.23' + + php84: + <<: *services_php82 + build: + args: + PHP_VERSION: '8.4' + MEMCACHE_VERSION: '8.2' + APCU_VERSION: '5.1.23' db: image: mysql:5.5.62 diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index bccc84486..cb76f7de7 100755 --- a/lib/autoload/sfCoreAutoload.class.php +++ b/lib/autoload/sfCoreAutoload.class.php @@ -9,7 +9,7 @@ */ // The current symfony version. -define('SYMFONY_VERSION', '1.6.2'); +define('SYMFONY_VERSION', '1.6.4'); /** * sfCoreAutoload class. diff --git a/lib/cache/sfCache.class.php b/lib/cache/sfCache.class.php index 60b9a2858..2b99edb47 100644 --- a/lib/cache/sfCache.class.php +++ b/lib/cache/sfCache.class.php @@ -220,7 +220,7 @@ public function setOption($name, $value) protected function patternToRegexp($pattern) { $regexp = str_replace( - ['\\*\\*', '\\*'], + ['\*\*', '\*'], ['.+?', '[^'.preg_quote(sfCache::SEPARATOR, '#').']+'], preg_quote($pattern, '#') ); diff --git a/lib/command/sfCommandManager.class.php b/lib/command/sfCommandManager.class.php index aea4b6bf3..9b3d88321 100644 --- a/lib/command/sfCommandManager.class.php +++ b/lib/command/sfCommandManager.class.php @@ -111,7 +111,7 @@ public function process($arguments = null) } } elseif (!is_array($arguments)) { // hack to split arguments with spaces : --test="with some spaces" - $arguments = preg_replace_callback('/(\'|")(.+?)\\1/', function ($match) { + $arguments = preg_replace_callback('/(\'|")(.+?)\1/', function ($match) { return str_replace(' ', '=PLACEHOLDER=', $match[2]); }, $arguments); $arguments = preg_split('/\s+/', $arguments); diff --git a/lib/debug/sfWebDebugPanel.class.php b/lib/debug/sfWebDebugPanel.class.php index 487feac49..4e87a3091 100644 --- a/lib/debug/sfWebDebugPanel.class.php +++ b/lib/debug/sfWebDebugPanel.class.php @@ -187,6 +187,6 @@ public function formatFileLink($file, $line = null, $text = null) */ public function formatSql($sql) { - return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '\\1', $sql); + return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '\1', $sql); } } diff --git a/lib/debug/sfWebDebugPanelLogs.class.php b/lib/debug/sfWebDebugPanelLogs.class.php index e80a05791..314281077 100644 --- a/lib/debug/sfWebDebugPanelLogs.class.php +++ b/lib/debug/sfWebDebugPanelLogs.class.php @@ -67,7 +67,7 @@ public function getPanelContent() ++$line_nb; $html .= sprintf( - "%s%s%s %s%s %s\n", + "%s%s %s%s %s\n", ucfirst($priority), $log['type'], $line_nb, @@ -121,9 +121,9 @@ protected function formatLogLine($logLine) // replace constants value with constant name $logLine = str_replace(array_keys($constants), array_values($constants), $logLine); - $logLine = preg_replace('/"(.+?)"/s', '\\1', $logLine); - $logLine = preg_replace('/^(.+?)\(\)\:/S', '\\1():', $logLine); - $logLine = preg_replace('/line (\d+)$/', 'line \\1', $logLine); + $logLine = preg_replace('/"(.+?)"/s', '\1', $logLine); + $logLine = preg_replace('/^(.+?)\(\)\:/S', '\1():', $logLine); + $logLine = preg_replace('/line (\d+)$/', 'line \1', $logLine); // special formatting for SQL lines $logLine = $this->formatSql($logLine); diff --git a/lib/exception/sfException.class.php b/lib/exception/sfException.class.php index a836834e5..454297c80 100644 --- a/lib/exception/sfException.class.php +++ b/lib/exception/sfException.class.php @@ -329,7 +329,10 @@ protected static function fileExcerpt($file, $line) } if (is_readable($file)) { - $content = preg_split('#
#', preg_replace('/^(.*)<\/code>$/s', '$1', highlight_file($file, true))); + $replaceRegex = '/^(?:
]+)?>|]+)?>\s*)(.*?)(?:<\/code><\/pre>|\s*<\/span>\s*<\/code>)$/s';
+            $splitRegex = '/(\r\n|\n|\r|
)/'; + + $content = preg_split($splitRegex, preg_replace($replaceRegex, '$1', highlight_file($file, true))); $lines = []; for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) { diff --git a/lib/form/sfFormField.class.php b/lib/form/sfFormField.class.php index e80fd67cd..dccf2e2c3 100644 --- a/lib/form/sfFormField.class.php +++ b/lib/form/sfFormField.class.php @@ -35,13 +35,13 @@ class sfFormField /** * Constructor. * - * @param sfWidgetForm $widget A sfWidget instance - * @param sfFormField $parent The sfFormField parent instance (null for the root widget) - * @param string $name The field name - * @param string $value The field value - * @param sfValidatorError $error A sfValidatorError instance + * @param sfWidgetForm $widget A sfWidget instance + * @param sfFormField|null $parent The sfFormField parent instance (null for the root widget) + * @param string $name The field name + * @param mixed $value The field value + * @param sfValidatorError|null $error A sfValidatorError instance */ - public function __construct(sfWidgetForm $widget, ?sfFormField $parent = null, $name = null, $value = null, ?sfValidatorError $error = null) + public function __construct(sfWidgetForm $widget, ?sfFormField $parent = null, $name = '', $value = null, ?sfValidatorError $error = null) { $this->widget = $widget; $this->parent = $parent; diff --git a/lib/form/sfFormFieldSchema.class.php b/lib/form/sfFormFieldSchema.class.php index 0eadebf94..4287af64a 100644 --- a/lib/form/sfFormFieldSchema.class.php +++ b/lib/form/sfFormFieldSchema.class.php @@ -22,13 +22,13 @@ class sfFormFieldSchema extends sfFormField implements ArrayAccess, Iterator, Co /** * Constructor. * - * @param sfWidgetFormSchema $widget A sfWidget instance - * @param sfFormField $parent The sfFormField parent instance (null for the root widget) - * @param string $name The field name - * @param string $value The field value - * @param sfValidatorError $error A sfValidatorError instance + * @param sfWidgetFormSchema $widget A sfWidget instance + * @param sfFormField|null $parent The sfFormField parent instance (null for the root widget) + * @param string $name The field name + * @param mixed $value The field value + * @param sfValidatorError|null $error A sfValidatorError instance */ - public function __construct(sfWidgetFormSchema $widget, ?sfFormField $parent = null, $name = null, $value = null, ?sfValidatorError $error = null) + public function __construct(sfWidgetFormSchema $widget, ?sfFormField $parent = null, $name = '', $value = null, ?sfValidatorError $error = null) { parent::__construct($widget, $parent, $name, $value, $error); diff --git a/lib/helper/EscapingHelper.php b/lib/helper/EscapingHelper.php index c142e05d0..247c1ba9f 100644 --- a/lib/helper/EscapingHelper.php +++ b/lib/helper/EscapingHelper.php @@ -107,7 +107,7 @@ function esc_js_no_entities($value) { return str_replace( ['\\', "\n", "\r", '"', "'"], - ['\\\\', '\\n', '\\r', '\\"', "\\'"], + ['\\\\', '\n', '\r', '\"', "\\'"], $value ); } diff --git a/lib/helper/TagHelper.php b/lib/helper/TagHelper.php index 05e00a11a..31d9eee5b 100644 --- a/lib/helper/TagHelper.php +++ b/lib/helper/TagHelper.php @@ -68,7 +68,7 @@ function comment_as_conditional($condition, $content) */ function escape_javascript($javascript = '') { - $javascript = preg_replace('/\r\n|\n|\r/', '\\n', $javascript); + $javascript = preg_replace('/\r\n|\n|\r/', '\n', $javascript); return preg_replace('/(["\'])/', '\\\\\1', $javascript); } diff --git a/lib/helper/TextHelper.php b/lib/helper/TextHelper.php index ed9d85a62..2f6864f7f 100644 --- a/lib/helper/TextHelper.php +++ b/lib/helper/TextHelper.php @@ -90,7 +90,7 @@ function truncate_text($text, $length = 30, $truncate_string = '...', $truncate_ * * @return string */ -function highlight_text($text, $phrase, $highlighter = '\\1') +function highlight_text($text, $phrase, $highlighter = '\1') { if (empty($text)) { return ''; @@ -220,7 +220,7 @@ function auto_link_text($text, $link = 'all', $href_options = [], $truncate = fa */ function strip_links_text($text) { - return preg_replace('/]*>(.*?)<\/a>/s', '\\1', $text); + return preg_replace('/]*>(.*?)<\/a>/s', '\1', $text); } if (!defined('SF_AUTO_LINK_RE')) { @@ -254,7 +254,7 @@ function _auto_link_urls($text, $href_options = [], $truncate = false, $truncate $href_options = _tag_options($href_options); $callback_function = function ($matches) use ($href_options, $truncate, $truncate_len, $pad) { - if (preg_match('/\\2@\\3', $text); + return preg_replace("#(^|[\n ])([a-z0-9&\\-_\\.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", '\1\2@\3', $text); // Removed since it destroys already linked emails // Example: bar gets bar gets bar // return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '\\1', $text); diff --git a/lib/i18n/Gettext/MO.php b/lib/i18n/Gettext/MO.php index 8d0d5998d..4cdaed7b1 100644 --- a/lib/i18n/Gettext/MO.php +++ b/lib/i18n/Gettext/MO.php @@ -222,7 +222,8 @@ public function load($file = null) // read all for ($i = 0; $i < $count; ++$i) { - $this->strings[$this->_readStr($original[$i])] = $this->_readStr($translat[$i]); + $this->strings[$this->_readStr($original[$i])] = + $this->_readStr($translat[$i]); } // done diff --git a/lib/i18n/Gettext/PO.php b/lib/i18n/Gettext/PO.php index ff4c1eec8..567ddf203 100644 --- a/lib/i18n/Gettext/PO.php +++ b/lib/i18n/Gettext/PO.php @@ -66,8 +66,8 @@ public function load($file = null) // match all msgid/msgstr entries $matched = preg_match_all( - '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+'. - '(msgstr\s+("([^"]|\\\\")*?"\s*)+)/', + '/(msgid\s+("([^"]|\\\")*?"\s*)+)\s+'. + '(msgstr\s+("([^"]|\\\")*?"\s*)+)/', $contents, $matches ); @@ -81,12 +81,12 @@ public function load($file = null) for ($i = 0; $i < $matched; ++$i) { $msgid = preg_replace( '/\s*msgid\s*"(.*)"\s*/s', - '\\1', + '\1', $matches[1][$i] ); $msgstr = preg_replace( '/\s*msgstr\s*"(.*)"\s*/s', - '\\1', + '\1', $matches[4][$i] ); $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr); diff --git a/lib/i18n/Gettext/TGettext.class.php b/lib/i18n/Gettext/TGettext.class.php index 7191b8743..2b24b127e 100644 --- a/lib/i18n/Gettext/TGettext.class.php +++ b/lib/i18n/Gettext/TGettext.class.php @@ -141,12 +141,12 @@ public function prepare($string, $reverse = false) { if ($reverse) { $smap = ['"', "\n", "\t", "\r"]; - $rmap = ['\"', '\\n"'."\n".'"', '\\t', '\\r']; + $rmap = ['\"', '\n"'."\n".'"', '\t', '\r']; return (string) str_replace($smap, $rmap, $string); } $string = preg_replace('/"\s+"/', '', $string); - $smap = ['\\n', '\\r', '\\t', '\"']; + $smap = ['\n', '\r', '\t', '\"']; $rmap = ["\n", "\r", "\t", '"']; return (string) str_replace($smap, $rmap, $string); diff --git a/lib/i18n/sfDateFormat.class.php b/lib/i18n/sfDateFormat.class.php index 309b3ab68..f10610f57 100644 --- a/lib/i18n/sfDateFormat.class.php +++ b/lib/i18n/sfDateFormat.class.php @@ -1,4 +1,5 @@ getFunctionName($pattern); - if (null != $function) { + if (null !== $function) { $function = ucfirst($function); $fName = 'get'.$function; if (in_array($fName, $this->methods)) { diff --git a/lib/log/sfPsrLoggerAdapter.class.php b/lib/log/sfPsrLoggerAdapter.class.php index 94d977660..8d8ff49d6 100644 --- a/lib/log/sfPsrLoggerAdapter.class.php +++ b/lib/log/sfPsrLoggerAdapter.class.php @@ -1,4 +1,5 @@ diff --git a/lib/log/sfWebDebugLogger.class.php b/lib/log/sfWebDebugLogger.class.php index d61c97dba..fe1779dae 100644 --- a/lib/log/sfWebDebugLogger.class.php +++ b/lib/log/sfWebDebugLogger.class.php @@ -56,8 +56,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = []) * PHP error handler send PHP errors to log. * * PHP user space error handler can not handle E_ERROR, E_PARSE, - * E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, - * and most of E_STRICT. + * E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and E_COMPILE_WARNING. * * @param string $errno the level of the error raised, as an integer * @param string $errstr the error message, as a string @@ -76,11 +75,6 @@ public function handlePhpError($errno, $errstr, $errfile, $errline, $errcontext $message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, str_replace('%', '%%', $errstr)); switch ($errno) { - case E_STRICT: - $this->dispatcher->notify(new sfEvent($this, 'application.log', ['priority' => sfLogger::ERR, sprintf($message, 'Strict notice')])); - - break; - case E_NOTICE: $this->dispatcher->notify(new sfEvent($this, 'application.log', ['priority' => sfLogger::NOTICE, sprintf($message, 'Notice')])); diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php index 1ccb8d1f8..ad2e2e208 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php @@ -543,7 +543,7 @@ public function getI18nModel() public function underscore($name) { - return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $name)); + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $name)); } /** @@ -567,13 +567,13 @@ public function getColumns() if ($parentModel) { $parentRelationNames = array_keys(Doctrine_Core::getTable($parentModel)->getRelations()); $relations = $this->table->getRelations(); - + $relationColumns = []; foreach (array_diff(array_keys($relations), $parentRelationNames) as $relationName) { if (Doctrine_Relation::ONE == $relations[$relationName]->getType()) { $columnName = $relations[$relationName]->getLocal(); - if (!in_array($columnName, $names)) { + if (!in_array($columnName, $relationColumns)) { + $relationColumns[] = $columnName; $columns[] = new sfDoctrineColumn($columnName, $this->table); - $names[] = $columnName; } } } diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php index 5b44311fb..0d2f2d009 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php @@ -117,16 +117,12 @@ protected function getDoctrineDatabases(sfDatabaseManager $databaseManager, ?arr protected function prepareSchemaFile($yamlSchemaPath) { $models = []; - $finder = sfFinder::type('file') - ->name('*.yml') - ->sort_by_name() - ->follow_link() - ; + $finder = sfFinder::type('file')->name('*.yml')->sort_by_name()->follow_link(); // plugin models foreach ($this->configuration->getPlugins() as $name) { $plugin = $this->configuration->getPluginConfiguration($name); - foreach ($finder->in("{$plugin->getRootDir()}/config/doctrine") as $schema) { + foreach ($finder->in($plugin->getRootDir().'/config/doctrine') as $schema) { $pluginModels = (array) sfYaml::load($schema); $globals = $this->filterSchemaGlobals($pluginModels); @@ -142,11 +138,11 @@ protected function prepareSchemaFile($yamlSchemaPath) // the first plugin to define this model gets the package if (!isset($models[$model]['package'])) { - $models[$model]['package'] = "{$plugin->getName()}.lib.model.doctrine"; + $models[$model]['package'] = $plugin->getName().'.lib.model.doctrine'; } if (!isset($models[$model]['package_custom_path']) && 0 === strpos($models[$model]['package'], $plugin->getName())) { - $models[$model]['package_custom_path'] = "{$plugin->getRootDir()}/lib/model/doctrine"; + $models[$model]['package_custom_path'] = $plugin->getRootDir().'/lib/model/doctrine'; } } } diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php index d027b64ef..64377694b 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php @@ -93,7 +93,7 @@ protected function execute($arguments = [], $options = []) // create a route $model = $arguments['route_or_model']; - $name = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $model)); + $name = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $model)); if (isset($options['module'])) { $route = $this->getRouteFromName($name); diff --git a/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php index 0fd637bc4..1e74a2284 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php @@ -113,7 +113,7 @@ public function debug($limit = null) if (is_integer($limit)) { $events = array_slice($events, $limit * -1); - } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $limit, $match)) { + } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $limit, $match)) { if ('!' == $match[1]) { $pattern = substr($limit, 1); $match = false; diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index a71100145..63c6b5da5 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -263,7 +263,7 @@ public function getPathInfo() } else { $pathInfo = $pathArray[$sf_path_info_key]; if ($relativeUrlRoot = $this->getRelativeUrlRoot()) { - $pathInfo = preg_replace('/^'.str_replace('/', '\\/', $relativeUrlRoot).'\//', '', $pathInfo); + $pathInfo = preg_replace('/^'.str_replace('/', '\/', $relativeUrlRoot).'\//', '', $pathInfo); } } diff --git a/lib/routing/sfRoute.class.php b/lib/routing/sfRoute.class.php index 25dd5cf96..543e95a3f 100644 --- a/lib/routing/sfRoute.class.php +++ b/lib/routing/sfRoute.class.php @@ -227,13 +227,7 @@ public function generate($params, $context = [], $absolute = false) // all params must be given if ($diff = array_diff_key($this->variables, $tparams)) { - $message = sprintf( - 'The "%s" route has some missing mandatory parameters (%s).', - $this->pattern, - implode(', ', $diff) - ); - - throw new InvalidArgumentException($message); + throw new InvalidArgumentException(sprintf('The "%s" route has some missing mandatory parameters (%s).', $this->pattern, implode(', ', $diff))); } if ($this->options['generate_shortest_url'] || $this->customToken) { @@ -520,14 +514,7 @@ protected function generateWithTokens($parameters) default: // handle custom tokens - $segment = call_user_func_array( - [ - $this, - 'generateFor'.ucfirst(array_shift($token)), - ], - array_merge([$optional, $parameters], $token) - ); - if ($segment) { + if ($segment = call_user_func_array([$this, 'generateFor'.ucfirst(array_shift($token))], array_merge([$optional, $parameters], $token))) { $url[] = $segment; $optional = false; } @@ -762,7 +749,7 @@ protected function generateStarParameter($url, $defaults, $parameters) if (is_array($value)) { foreach ($value as $v) { $v = is_null($v) ? '' : $v; - $tmp[] = "{$key}=".urlencode($v); + $tmp[] = $key.'='.urlencode($v); } } else { $value = is_null($value) ? '' : $value; @@ -771,16 +758,10 @@ protected function generateStarParameter($url, $defaults, $parameters) } $tmp = implode('/', $tmp); if ($tmp) { - $tmp = "/{$tmp}"; + $tmp = '/'.$tmp; } - $separator = $this->options['segment_separators_regex']; - - return preg_replace( - '#'.$separator.'\*('.$separator.'|$)#', - "{$tmp}$1", - $url - ); + return preg_replace('#'.$this->options['segment_separators_regex'].'\*('.$this->options['segment_separators_regex'].'|$)#', "{$tmp}$1", $url); } protected function mergeArrays($arr1, $arr2) diff --git a/lib/service/sfServiceContainer.class.php b/lib/service/sfServiceContainer.class.php index 195fd5110..178183196 100644 --- a/lib/service/sfServiceContainer.class.php +++ b/lib/service/sfServiceContainer.class.php @@ -207,6 +207,6 @@ public static function camelize($id) public static function underscore($id) { - return strtolower(preg_replace(['/_/', '/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['.', '\\1_\\2', '\\1_\\2'], $id)); + return strtolower(preg_replace(['/_/', '/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['.', '\1_\2', '\1_\2'], $id)); } } diff --git a/lib/storage/sfCacheSessionStorage.class.php b/lib/storage/sfCacheSessionStorage.class.php index 4c355d401..61330ece7 100644 --- a/lib/storage/sfCacheSessionStorage.class.php +++ b/lib/storage/sfCacheSessionStorage.class.php @@ -116,7 +116,7 @@ public function initialize($options = []) // only send cookie when id is issued $this->response->setCookie( $this->options['session_name'], - "{$this->id}:".sha1("{$this->id}:{$this->options['session_cookie_secret']}"), + $this->id.':'.sha1($this->id.':'.$this->options['session_cookie_secret']), $this->options['session_cookie_lifetime'], $this->options['session_cookie_path'], $this->options['session_cookie_domain'], diff --git a/lib/test/sfTestFunctionalBase.class.php b/lib/test/sfTestFunctionalBase.class.php index d9feef311..a07bdde38 100644 --- a/lib/test/sfTestFunctionalBase.class.php +++ b/lib/test/sfTestFunctionalBase.class.php @@ -370,7 +370,7 @@ public function throwsException($class = null, $message = null) $this->test()->ok($e instanceof $class, sprintf('response returns an exception of class "%s"', $class)); } - if (null !== $message && preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $message, $match)) { + if (null !== $message && preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $message, $match)) { if ('!' == $match[1]) { $this->test()->unlike($e->getMessage(), substr($message, 1), sprintf('response exception message does not match regex "%s"', $message)); } else { diff --git a/lib/test/sfTesterForm.class.php b/lib/test/sfTesterForm.class.php index a7a49b0aa..521acabcc 100644 --- a/lib/test/sfTesterForm.class.php +++ b/lib/test/sfTesterForm.class.php @@ -137,7 +137,7 @@ public function isError($field, $value = true) $this->tester->ok($error && count($error) > 0, sprintf('the submitted form has a "%s" error.', $field)); } elseif (is_int($value)) { $this->tester->ok($error && count($error) == $value, sprintf('the submitted form has %s "%s" error(s).', $value, $field)); - } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { if (!$error) { $this->tester->fail(sprintf('the submitted form has a "%s" error.', $field)); } else { diff --git a/lib/test/sfTesterMailer.class.php b/lib/test/sfTesterMailer.class.php index 227b6608d..20a4fc614 100644 --- a/lib/test/sfTesterMailer.class.php +++ b/lib/test/sfTesterMailer.class.php @@ -128,7 +128,7 @@ public function checkBody($value) $ok = false; $regex = false; $mustMatch = true; - if (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + if (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { $regex = $value; if ('!' == $match[1]) { $mustMatch = false; @@ -186,7 +186,7 @@ public function checkHeader($key, $value) $ok = false; $regex = false; $mustMatch = true; - if (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + if (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { $regex = $value; if ('!' == $match[1]) { $mustMatch = false; diff --git a/lib/test/sfTesterRequest.class.php b/lib/test/sfTesterRequest.class.php index 4264ff2b8..cbb727a85 100644 --- a/lib/test/sfTesterRequest.class.php +++ b/lib/test/sfTesterRequest.class.php @@ -120,7 +120,7 @@ public function isCookie($name, $value) return $this->getObjectToReturn(); } - if (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + if (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { if ('!' == $match[1]) { $this->tester->unlike($_COOKIE[$name], substr($value, 1), sprintf('cookie "%s" content does not match regex "%s"', $name, $value)); } else { diff --git a/lib/test/sfTesterResponse.class.php b/lib/test/sfTesterResponse.class.php index 34f7ffcf1..966eae2ea 100644 --- a/lib/test/sfTesterResponse.class.php +++ b/lib/test/sfTesterResponse.class.php @@ -76,7 +76,7 @@ public function checkElement($selector, $value = true, $options = []) $this->tester->cmp_ok(count($values), '>', 0, sprintf('response selector "%s" exists', $selector)); } elseif (is_int($value)) { $this->tester->is(count($values), $value, sprintf('response selector "%s" matches "%s" times', $selector, $value)); - } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { $position = isset($options['position']) ? $options['position'] : 0; if ('!' == $match[1]) { $this->tester->unlike(@$values[$position], substr($value, 1), sprintf('response selector "%s" does not match regex "%s"', $selector, substr($value, 1))); @@ -175,7 +175,7 @@ public function isValid($checkDTD = false) $filesystem->replaceTokens($finder->in($cache), '##', '##', ['LOCAL_W3' => $local]); } - $content = preg_replace('#(]+")http://www.w3.org(.*")#i', '\\1'.$local.'\\2', $content); + $content = preg_replace('#(]+")http://www.w3.org(.*")#i', '\1'.$local.'\2', $content); $dom->validateOnParse = $checkDTD; } @@ -236,7 +236,7 @@ public function isHeader($key, $value) $ok = false; $regex = false; $mustMatch = true; - if (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) { + if (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $value, $match)) { $regex = $value; if ('!' == $match[1]) { $mustMatch = false; @@ -325,7 +325,7 @@ public function setsCookie($name, $value = null, $attributes = []) */ public function matches($regex) { - if (!preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $regex, $match)) { + if (!preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $regex, $match)) { throw new InvalidArgumentException(sprintf('"%s" is not a valid regular expression.', $regex)); } diff --git a/lib/util/sfFinder.class.php b/lib/util/sfFinder.class.php index f8874f4c5..25f008c06 100644 --- a/lib/util/sfFinder.class.php +++ b/lib/util/sfFinder.class.php @@ -374,7 +374,7 @@ public static function isPathAbsolute($path) // glob, patterns (must be //) or strings protected function to_regex($str) { - if (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $str)) { + if (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $str)) { return $str; } @@ -642,11 +642,11 @@ public static function glob_to_regex($glob) if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) { $regex .= "\\{$car}"; } elseif ('*' === $car) { - $regex .= ($escaping ? '\\*' : (self::$strict_wildcard_slash ? '[^/]*' : '.*')); + $regex .= ($escaping ? '\*' : (self::$strict_wildcard_slash ? '[^/]*' : '.*')); } elseif ('?' === $car) { - $regex .= ($escaping ? '\\?' : (self::$strict_wildcard_slash ? '[^/]' : '.')); + $regex .= ($escaping ? '\?' : (self::$strict_wildcard_slash ? '[^/]' : '.')); } elseif ('{' === $car) { - $regex .= ($escaping ? '\\{' : '('); + $regex .= ($escaping ? '\{' : '('); if (!$escaping) { ++$in_curlies; } diff --git a/lib/util/sfInflector.class.php b/lib/util/sfInflector.class.php index 728d88773..6ba83250f 100644 --- a/lib/util/sfInflector.class.php +++ b/lib/util/sfInflector.class.php @@ -37,8 +37,8 @@ public static function underscore($camel_cased_word) { $tmp = (string) $camel_cased_word; $tmp = str_replace('::', '/', $tmp); - $tmp = sfToolkit::pregtr($tmp, ['/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2', - '/([a-z\d])([A-Z])/' => '\\1_\\2']); + $tmp = sfToolkit::pregtr($tmp, ['/([A-Z]+)([A-Z][a-z])/' => '\1_\2', + '/([a-z\d])([A-Z])/' => '\1_\2']); return strtolower($tmp); } diff --git a/lib/util/sfToolkit.class.php b/lib/util/sfToolkit.class.php index f49a76561..0b4e9c490 100644 --- a/lib/util/sfToolkit.class.php +++ b/lib/util/sfToolkit.class.php @@ -244,11 +244,11 @@ public static function arrayDeepMerge() public static function stringToArray($string) { preg_match_all('/ - \s*((?:\w+-)*\w+) # key \\1 + \s*((?:\w+-)*\w+) # key \1 \s*=\s* # = - (\'|")? # values may be included in \' or " \\2 - (.*?) # value \\3 - (?(2) \\2) # matching \' or " if needed \\4 + (\'|")? # values may be included in \' or " \2 + (.*?) # value \3 + (?(2) \2) # matching \' or " if needed \4 \s*(?: (?=\w+\s*=) | \s*$ # followed by another key= or the end of the string ) diff --git a/lib/view/sfViewCacheManager.class.php b/lib/view/sfViewCacheManager.class.php index 2ccaa0139..135c5a1a0 100644 --- a/lib/view/sfViewCacheManager.class.php +++ b/lib/view/sfViewCacheManager.class.php @@ -180,8 +180,8 @@ public function generateCacheKey($internalUri, $hostName = '', $vary = '', $cont return strtr($cacheKey, [ '/.' => '/_.', '/_' => '/__', - '\\.' => '\\_.', - '\\_' => '\\__', + '\.' => '\_.', + '\_' => '\__', ]); } diff --git a/lib/yaml/sfYamlInline.class.php b/lib/yaml/sfYamlInline.class.php index c0527e848..25a5764a2 100644 --- a/lib/yaml/sfYamlInline.class.php +++ b/lib/yaml/sfYamlInline.class.php @@ -15,7 +15,7 @@ */ class sfYamlInline { - public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + public const REGEX_QUOTED_STRING = '(?:"([^"\\\]*(?:\\\.[^"\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; /** * Convert a YAML string to a PHP array. @@ -102,7 +102,7 @@ public static function dump($value) return is_infinite($value) ? str_ireplace('INF', '.Inf', (string) $value) : (is_string($value) ? "'{$value}'" : $value); case false !== strpos($value, "\n") || false !== strpos($value, "\r"): - return sprintf('"%s"', str_replace(['"', "\n", "\r"], ['\\"', '\n', '\r'], $value)); + return sprintf('"%s"', str_replace(['"', "\n", "\r"], ['\"', '\n', '\r'], $value)); case preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value): return sprintf("'%s'", str_replace('\'', '\'\'', $value)); @@ -214,7 +214,7 @@ protected static function parseQuotedScalar($scalar, &$i) if ('"' == $scalar[$i]) { // evaluate the string - $output = str_replace(['\\"', '\\n', '\\r'], ['"', "\n", "\r"], $output); + $output = str_replace(['\"', '\n', '\r'], ['"', "\n", "\r"], $output); } else { // unescape ' $output = str_replace('\'\'', '\'', $output); diff --git a/test/unit/helper/EscapingHelperTest.php b/test/unit/helper/EscapingHelperTest.php index 012c228fb..61dfc86b4 100644 --- a/test/unit/helper/EscapingHelperTest.php +++ b/test/unit/helper/EscapingHelperTest.php @@ -33,12 +33,12 @@ // esc_js_no_entities() $t->diag('esc_js_no_entities()'); -$t->is(esc_js_no_entities('alert(\'foo\' + "bar")'), 'alert(\\\'foo\\\' + \\"bar\\")', 'esc_js_no_entities() escapes javascripts'); -$t->is(esc_js_no_entities('alert("hi\\there")'), 'alert(\\"hi\\\\there\\")', 'esc_js_no_entities() handles slashes correctly'); -$t->is(esc_js_no_entities('alert("été")'), 'alert(\\"été\\")', 'esc_js_no_entities() preserves utf-8'); +$t->is(esc_js_no_entities('alert(\'foo\' + "bar")'), 'alert(\\\'foo\\\' + \"bar\")', 'esc_js_no_entities() escapes javascripts'); +$t->is(esc_js_no_entities('alert("hi\there")'), 'alert(\"hi\\\there\")', 'esc_js_no_entities() handles slashes correctly'); +$t->is(esc_js_no_entities('alert("été")'), 'alert(\"été\")', 'esc_js_no_entities() preserves utf-8'); $output = <<<'EOF' alert('hello world') EOF; -$t->is(esc_js_no_entities(fix_linebreaks($output)), 'alert(\\\'hello\\nworld\\\')', 'esc_js_no_entities() handles linebreaks correctly'); -$t->is(esc_js_no_entities("alert('hello\nworld')"), 'alert(\\\'hello\\nworld\\\')', 'esc_js_no_entities() handles linebreaks correctly'); +$t->is(esc_js_no_entities(fix_linebreaks($output)), 'alert(\\\'hello\nworld\\\')', 'esc_js_no_entities() handles linebreaks correctly'); +$t->is(esc_js_no_entities("alert('hello\nworld')"), 'alert(\\\'hello\nworld\\\')', 'esc_js_no_entities() handles linebreaks correctly'); diff --git a/test/unit/helper/TagHelperTest.php b/test/unit/helper/TagHelperTest.php index b40920e1d..a063f28ff 100644 --- a/test/unit/helper/TagHelperTest.php +++ b/test/unit/helper/TagHelperTest.php @@ -42,7 +42,7 @@ // escape_javascript() $t->diag('escape_javascript()'); -$t->is(escape_javascript("alert('foo');\nalert(\"bar\");"), 'alert(\\\'foo\\\');\\nalert(\\"bar\\");', 'escape_javascript() escapes JavaScript scripts'); +$t->is(escape_javascript("alert('foo');\nalert(\"bar\");"), 'alert(\\\'foo\\\');\nalert(\"bar\");', 'escape_javascript() escapes JavaScript scripts'); // _get_option() $t->diag('_get_option()'); diff --git a/test/unit/helper/TextHelperTest.php b/test/unit/helper/TextHelperTest.php index ddf748da7..2a1a199a3 100644 --- a/test/unit/helper/TextHelperTest.php +++ b/test/unit/helper/TextHelperTest.php @@ -78,7 +78,7 @@ ); $t->is( - highlight_text('This is a beautiful morning, but also a beautiful day', 'beautiful', '\\1'), + highlight_text('This is a beautiful morning, but also a beautiful day', 'beautiful', '\1'), 'This is a beautiful morning, but also a beautiful day', 'text_highlighter() takes a pattern as its third argument' ); diff --git a/test/unit/routing/fixtures/config_routing.yml.php b/test/unit/routing/fixtures/config_routing.yml.php index 5efcef50d..c9d0e55e0 100644 --- a/test/unit/routing/fixtures/config_routing.yml.php +++ b/test/unit/routing/fixtures/config_routing.yml.php @@ -1,4 +1,4 @@ routes['test1'] = 'C:7:"sfRoute":1143:{a:11:{i:0;a:2:{i:0;a:4:{i:0;s:9:"separator";i:1;s:0:"";i:2;s:1:"/";i:3;N;}i:1;a:3:{i:0;s:9:"separator";i:1;s:1:"/";i:2;s:1:"/";}}i:1;a:9:{s:18:"load_configuration";b:1;s:6:"suffix";s:0:"";s:14:"default_module";s:7:"default";s:14:"default_action";s:5:"index";s:5:"debug";s:0:"";s:7:"logging";s:0:"";s:21:"generate_shortest_url";b:1;s:32:"extra_parameters_as_query_string";b:1;s:27:"lookup_cache_dedicated_keys";b:1;}i:2;a:16:{s:6:"suffix";s:0:"";s:17:"variable_prefixes";a:1:{i:0;s:1:":";}s:18:"segment_separators";a:2:{i:0;s:1:"/";i:1;s:1:".";}s:14:"variable_regex";s:8:"[\\w\\d_]+";s:10:"text_regex";s:3:".+?";s:21:"generate_shortest_url";b:1;s:32:"extra_parameters_as_query_string";b:1;s:18:"load_configuration";b:1;s:14:"default_module";s:7:"default";s:14:"default_action";s:5:"index";s:5:"debug";s:0:"";s:7:"logging";s:0:"";s:27:"lookup_cache_dedicated_keys";b:1;s:21:"variable_prefix_regex";s:6:"(?:\\:)";s:24:"segment_separators_regex";s:8:"(?:/|\\.)";s:22:"variable_content_regex";s:7:"[^/\\.]+";}i:3;s:1:"/";i:4;s:0:"";i:5;s:6:"#^/$#x";i:6;a:0:{}i:7;a:2:{s:6:"module";s:7:"default";s:6:"action";s:5:"index";}i:8;a:0:{}i:9;s:1:"/";i:10;b:0;}}'; +$this->routes['test1'] = 'C:7:"sfRoute":1143:{a:11:{i:0;a:2:{i:0;a:4:{i:0;s:9:"separator";i:1;s:0:"";i:2;s:1:"/";i:3;N;}i:1;a:3:{i:0;s:9:"separator";i:1;s:1:"/";i:2;s:1:"/";}}i:1;a:9:{s:18:"load_configuration";b:1;s:6:"suffix";s:0:"";s:14:"default_module";s:7:"default";s:14:"default_action";s:5:"index";s:5:"debug";s:0:"";s:7:"logging";s:0:"";s:21:"generate_shortest_url";b:1;s:32:"extra_parameters_as_query_string";b:1;s:27:"lookup_cache_dedicated_keys";b:1;}i:2;a:16:{s:6:"suffix";s:0:"";s:17:"variable_prefixes";a:1:{i:0;s:1:":";}s:18:"segment_separators";a:2:{i:0;s:1:"/";i:1;s:1:".";}s:14:"variable_regex";s:8:"[\w\d_]+";s:10:"text_regex";s:3:".+?";s:21:"generate_shortest_url";b:1;s:32:"extra_parameters_as_query_string";b:1;s:18:"load_configuration";b:1;s:14:"default_module";s:7:"default";s:14:"default_action";s:5:"index";s:5:"debug";s:0:"";s:7:"logging";s:0:"";s:27:"lookup_cache_dedicated_keys";b:1;s:21:"variable_prefix_regex";s:6:"(?:\:)";s:24:"segment_separators_regex";s:8:"(?:/|\.)";s:22:"variable_content_regex";s:7:"[^/\.]+";}i:3;s:1:"/";i:4;s:0:"";i:5;s:6:"#^/$#x";i:6;a:0:{}i:7;a:2:{s:6:"module";s:7:"default";s:6:"action";s:5:"index";}i:8;a:0:{}i:9;s:1:"/";i:10;b:0;}}'; diff --git a/test/unit/task/sfFilesystemTest.php b/test/unit/task/sfFilesystemTest.php index 0d930cc03..f0801fe0f 100644 --- a/test/unit/task/sfFilesystemTest.php +++ b/test/unit/task/sfFilesystemTest.php @@ -31,7 +31,7 @@ public function canonicalizePath($path) $filesystem = new myFilesystem($dispatcher, null); $t->diag('sfFilesystem canonicalizes pathes'); -$t->is($filesystem->canonicalizePath('..'.DS.DS.'.'.DS.'..'.DS.'dir4'.DS.DS.'.'.DS.'dir5'.DS.'dir6'.DS.'..'.DS.DS.'dir7'.DS), '..'.DS.'..'.DS.'dir4'.DS.'dir5'.DS.'dir7'.DS, '->canonicalizePath() correctly resolves "\\.." and "\\."'); +$t->is($filesystem->canonicalizePath('..'.DS.DS.'.'.DS.'..'.DS.'dir4'.DS.DS.'.'.DS.'dir5'.DS.'dir6'.DS.'..'.DS.DS.'dir7'.DS), '..'.DS.'..'.DS.'dir4'.DS.'dir5'.DS.'dir7'.DS, '->canonicalizePath() correctly resolves "\.." and "\."'); $t->diag('sfFilesystem calculates relative pathes'); $common = DS.'tmp'.DS.'sfproject'.DS; diff --git a/test/unit/util/sfToolkitTest.php b/test/unit/util/sfToolkitTest.php index 984720409..8a0233758 100644 --- a/test/unit/util/sfToolkitTest.php +++ b/test/unit/util/sfToolkitTest.php @@ -85,12 +85,12 @@ // ::isPathAbsolute() $t->diag('::isPathAbsolute()'); $t->is(sfToolkit::isPathAbsolute('/test'), true, '::isPathAbsolute() returns true if path is absolute'); -$t->is(sfToolkit::isPathAbsolute('\\test'), true, '::isPathAbsolute() returns true if path is absolute'); -$t->is(sfToolkit::isPathAbsolute('C:\\test'), true, '::isPathAbsolute() returns true if path is absolute'); +$t->is(sfToolkit::isPathAbsolute('\test'), true, '::isPathAbsolute() returns true if path is absolute'); +$t->is(sfToolkit::isPathAbsolute('C:\test'), true, '::isPathAbsolute() returns true if path is absolute'); $t->is(sfToolkit::isPathAbsolute('d:/test'), true, '::isPathAbsolute() returns true if path is absolute'); $t->is(sfToolkit::isPathAbsolute('test'), false, '::isPathAbsolute() returns false if path is relative'); $t->is(sfToolkit::isPathAbsolute('../test'), false, '::isPathAbsolute() returns false if path is relative'); -$t->is(sfToolkit::isPathAbsolute('..\\test'), false, '::isPathAbsolute() returns false if path is relative'); +$t->is(sfToolkit::isPathAbsolute('..\test'), false, '::isPathAbsolute() returns false if path is relative'); // ::stripComments() $t->diag('::stripComments()'); diff --git a/test/unit/view/sfViewCacheManagerTest.php b/test/unit/view/sfViewCacheManagerTest.php index a4cca20cc..8f683934d 100644 --- a/test/unit/view/sfViewCacheManagerTest.php +++ b/test/unit/view/sfViewCacheManagerTest.php @@ -285,7 +285,7 @@ public function getCurrentInternalUri($with_route_name = false) $m = new myViewCacheManager($context, new myCache()); $t->is($m->generateCacheKey('mymodule/myaction?foo=../_bar'), '/localhost/all/mymodule/myaction/foo/_../__bar', '->generateCacheKey() prevents directory traversal'); -$t->is($m->generateCacheKey('mymodule/myaction?foo=..\\_bar'), '/localhost/all/mymodule/myaction/foo/_..\\__bar', '->generateCacheKey() prevents directory traversal'); +$t->is($m->generateCacheKey('mymodule/myaction?foo=..\_bar'), '/localhost/all/mymodule/myaction/foo/_..\__bar', '->generateCacheKey() prevents directory traversal'); // ->getCurrentCacheKey() $t->diag('->getCurrentCacheKey()'); diff --git a/test/unit/yaml/sfYamlInlineTest.php b/test/unit/yaml/sfYamlInlineTest.php index 625658d88..9d527bfb1 100644 --- a/test/unit/yaml/sfYamlInlineTest.php +++ b/test/unit/yaml/sfYamlInlineTest.php @@ -40,7 +40,7 @@ '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007), - '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', + '"a \"string\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', // sequences