Skip to content

Commit

Permalink
Merge branch '2.5' into 2.6
Browse files Browse the repository at this point in the history
* 2.5:
  [HttpFoundation] [Request] fix baseUrl parsing to fix wrong path_info
  [Twig][Bridge][TranslationDefaultDomain] add support of named arguments.
  [Form] Improved exception message if the data class is not found
  Fixes ArgvInput's argument getter with empty tokens
  execute cheaper checks before more expensive ones
  [FrameworkBundle] FormDataCollector should be loaded only if form config is enabled

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml
  • Loading branch information
fabpot committed Jan 20, 2015
2 parents 655c629 + 04aa5b8 commit 58fc9f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ public static function escapeWithDoubleQuotes($value)
*/
public static function requiresSingleQuoting($value)
{
// Determines if the PHP value contains any single characters that would
// cause it to require single quoting in YAML.
if (preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value)) {
// Determines if a PHP value is entirely composed of a value that would
// require single quoting in YAML.
if (in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) {
return true;
}

// Determines if a PHP value is entirely composed of a value that would
// require single quoting in YAML.
return in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'));
// Determines if the PHP value contains any single characters that would
// cause it to require single quoting in YAML.
return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp
}

return $repr;
case '' == $value:
return "''";
case Escaper::requiresDoubleQuoting($value):
return Escaper::escapeWithDoubleQuotes($value);
case Escaper::requiresSingleQuoting($value):
case preg_match(self::getTimestampRegex(), $value):
return Escaper::escapeWithSingleQuotes($value);
case '' == $value:
return "''";
default:
return $value;
}
Expand Down

0 comments on commit 58fc9f7

Please sign in to comment.