Merge branch '2.6' into 2.7
* 2.6: [Validator] Add missing pt_BR translations Add parsing of hexadecimal strings for PHP 7 [Configuration] improve description for ignoreExtraKeys on ArrayNodeDefinition [Validator] Added missing Hungarian translation [Validator] Fixed grammar in Hungarian translation CS: Unary operators should be placed adjacent to their operands CS: Binary operators should be arounded by at least one space remove useless tests that fail in php 7 [Translator] fix test for php 7 compatibility Update phpdoc of ProcessBuilder#setPrefix() Conflicts: src/Symfony/Bridge/Propel1/Logger/PropelLogger.php src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf
This commit is contained in:
commit
d5c873cf5a
@ -60,7 +60,7 @@ abstract class DoctrineType extends AbstractType
|
|||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$choiceListCache = & $this->choiceListCache;
|
$choiceListCache = &$this->choiceListCache;
|
||||||
$registry = $this->registry;
|
$registry = $this->registry;
|
||||||
$propertyAccessor = $this->propertyAccessor;
|
$propertyAccessor = $this->propertyAccessor;
|
||||||
$type = $this;
|
$type = $this;
|
||||||
|
@ -87,7 +87,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$testString = 'abc';
|
$testString = 'abc';
|
||||||
|
|
||||||
$shortString = str_pad('', DbalLogger::MAX_STRING_LENGTH, $testString);
|
$shortString = str_pad('', DbalLogger::MAX_STRING_LENGTH, $testString);
|
||||||
$longString = str_pad('', DbalLogger::MAX_STRING_LENGTH+1, $testString);
|
$longString = str_pad('', DbalLogger::MAX_STRING_LENGTH + 1, $testString);
|
||||||
|
|
||||||
$dbalLogger
|
$dbalLogger
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -49,7 +49,7 @@ class LazyServiceProjectServiceContainer extends Container
|
|||||||
$container = $this;
|
$container = $this;
|
||||||
|
|
||||||
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
|
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
|
||||||
function (& $wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
|
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
|
||||||
$wrappedInstance = $container->getFooService(false);
|
$wrappedInstance = $container->getFooService(false);
|
||||||
|
|
||||||
$proxy->setProxyInitializer(null);
|
$proxy->setProxyInitializer(null);
|
||||||
|
@ -204,7 +204,7 @@ class Cookie
|
|||||||
private static function parseDate($dateValue)
|
private static function parseDate($dateValue)
|
||||||
{
|
{
|
||||||
// trim single quotes around date if present
|
// trim single quotes around date if present
|
||||||
if (($length = strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length-1]) {
|
if (($length = strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length - 1]) {
|
||||||
$dateValue = substr($dateValue, 1, -1);
|
$dateValue = substr($dateValue, 1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,9 +279,10 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
* Allows extra config keys to be specified under an array without
|
* Allows extra config keys to be specified under an array without
|
||||||
* throwing an exception.
|
* throwing an exception.
|
||||||
*
|
*
|
||||||
* Those config values are simply ignored. This should be used only
|
* Those config values are simply ignored and removed from the
|
||||||
* in special cases where you want to send an entire configuration
|
* resulting array. This should be used only in special cases where
|
||||||
* array through a special tree that processes only part of the array.
|
* you want to send an entire configuration array through a special
|
||||||
|
* tree that processes only part of the array.
|
||||||
*
|
*
|
||||||
* @return ArrayNodeDefinition
|
* @return ArrayNodeDefinition
|
||||||
*/
|
*/
|
||||||
|
@ -231,7 +231,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
|
|
||||||
$value = $this->remapXml($value);
|
$value = $this->remapXml($value);
|
||||||
|
|
||||||
$isAssoc = array_keys($value) !== range(0, count($value) -1);
|
$isAssoc = array_keys($value) !== range(0, count($value) - 1);
|
||||||
$normalized = array();
|
$normalized = array();
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
if (null !== $this->keyAttribute && is_array($v)) {
|
if (null !== $this->keyAttribute && is_array($v)) {
|
||||||
|
@ -93,7 +93,7 @@ abstract class FileLoader extends Loader
|
|||||||
$resources = is_array($resource) ? $resource : array($resource);
|
$resources = is_array($resource) ? $resource : array($resource);
|
||||||
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
|
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
|
||||||
if (isset(self::$loading[$resources[$i]])) {
|
if (isset(self::$loading[$resources[$i]])) {
|
||||||
if ($i == $resourcesCount-1) {
|
if ($i == $resourcesCount - 1) {
|
||||||
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
|
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,6 +207,8 @@ class XmlUtils
|
|||||||
return bindec($value);
|
return bindec($value);
|
||||||
case is_numeric($value):
|
case is_numeric($value):
|
||||||
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
|
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
|
||||||
|
case preg_match('/^0x[0-9a-f]++$/i', $value):
|
||||||
|
return hexdec($value);
|
||||||
case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):
|
case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):
|
||||||
return (float) $value;
|
return (float) $value;
|
||||||
default:
|
default:
|
||||||
|
@ -96,7 +96,7 @@ class OutputFormatterStyleStack
|
|||||||
return $this->emptyStyle;
|
return $this->emptyStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->styles[count($this->styles)-1];
|
return $this->styles[count($this->styles) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1484,14 +1484,14 @@ EOF;
|
|||||||
$i = $this->variableCount;
|
$i = $this->variableCount;
|
||||||
|
|
||||||
if ('' === $name) {
|
if ('' === $name) {
|
||||||
$name .= $firstChars[$i%$firstCharsLength];
|
$name .= $firstChars[$i % $firstCharsLength];
|
||||||
$i = (int) ($i/$firstCharsLength);
|
$i = (int) ($i / $firstCharsLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($i > 0) {
|
while ($i > 0) {
|
||||||
--$i;
|
--$i;
|
||||||
$name .= $nonFirstChars[$i%$nonFirstCharsLength];
|
$name .= $nonFirstChars[$i % $nonFirstCharsLength];
|
||||||
$i = (int) ($i/$nonFirstCharsLength);
|
$i = (int) ($i / $nonFirstCharsLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
++$this->variableCount;
|
++$this->variableCount;
|
||||||
|
@ -33,16 +33,16 @@ class FormFieldRegistry
|
|||||||
{
|
{
|
||||||
$segments = $this->getSegments($field->getName());
|
$segments = $this->getSegments($field->getName());
|
||||||
|
|
||||||
$target = & $this->fields;
|
$target = &$this->fields;
|
||||||
while ($segments) {
|
while ($segments) {
|
||||||
if (!is_array($target)) {
|
if (!is_array($target)) {
|
||||||
$target = array();
|
$target = array();
|
||||||
}
|
}
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if ('' === $path) {
|
if ('' === $path) {
|
||||||
$target = & $target[];
|
$target = &$target[];
|
||||||
} else {
|
} else {
|
||||||
$target = & $target[$path];
|
$target = &$target[$path];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$target = $field;
|
$target = $field;
|
||||||
@ -58,13 +58,13 @@ class FormFieldRegistry
|
|||||||
public function remove($name)
|
public function remove($name)
|
||||||
{
|
{
|
||||||
$segments = $this->getSegments($name);
|
$segments = $this->getSegments($name);
|
||||||
$target = & $this->fields;
|
$target = &$this->fields;
|
||||||
while (count($segments) > 1) {
|
while (count($segments) > 1) {
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if (!array_key_exists($path, $target)) {
|
if (!array_key_exists($path, $target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$target = & $target[$path];
|
$target = &$target[$path];
|
||||||
}
|
}
|
||||||
unset($target[array_shift($segments)]);
|
unset($target[array_shift($segments)]);
|
||||||
}
|
}
|
||||||
@ -82,13 +82,13 @@ class FormFieldRegistry
|
|||||||
public function &get($name)
|
public function &get($name)
|
||||||
{
|
{
|
||||||
$segments = $this->getSegments($name);
|
$segments = $this->getSegments($name);
|
||||||
$target = & $this->fields;
|
$target = &$this->fields;
|
||||||
while ($segments) {
|
while ($segments) {
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if (!array_key_exists($path, $target)) {
|
if (!array_key_exists($path, $target)) {
|
||||||
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
|
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
|
||||||
}
|
}
|
||||||
$target = & $target[$path];
|
$target = &$target[$path];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $target;
|
return $target;
|
||||||
@ -123,7 +123,7 @@ class FormFieldRegistry
|
|||||||
*/
|
*/
|
||||||
public function set($name, $value)
|
public function set($name, $value)
|
||||||
{
|
{
|
||||||
$target = & $this->get($name);
|
$target = &$this->get($name);
|
||||||
if (!is_array($value) || $target instanceof Field\ChoiceFormField) {
|
if (!is_array($value) || $target instanceof Field\ChoiceFormField) {
|
||||||
$target->setValue($value);
|
$target->setValue($value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -272,7 +272,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
|||||||
foreach ($dates as $i => $date) {
|
foreach ($dates as $i => $date) {
|
||||||
$command->add($i > 0 ? '-and' : null);
|
$command->add($i > 0 ? '-and' : null);
|
||||||
|
|
||||||
$mins = (int) round((time()-$date->getTarget()) / 60);
|
$mins = (int) round((time() - $date->getTarget()) / 60);
|
||||||
|
|
||||||
if (0 > $mins) {
|
if (0 > $mins) {
|
||||||
// mtime is in the future
|
// mtime is in the future
|
||||||
|
@ -64,13 +64,13 @@ class NumberComparator extends Comparator
|
|||||||
$target *= 1000000;
|
$target *= 1000000;
|
||||||
break;
|
break;
|
||||||
case 'mi':
|
case 'mi':
|
||||||
$target *= 1024*1024;
|
$target *= 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
$target *= 1000000000;
|
$target *= 1000000000;
|
||||||
break;
|
break;
|
||||||
case 'gi':
|
case 'gi':
|
||||||
$target *= 1024*1024*1024;
|
$target *= 1024 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ class Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->bits[] = self::create($this);
|
$this->bits[] = self::create($this);
|
||||||
$this->labels[$label] = count($this->bits)-1;
|
$this->labels[$label] = count($this->bits) - 1;
|
||||||
|
|
||||||
return $this->bits[$this->labels[$label]];
|
return $this->bits[$this->labels[$label]];
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,10 @@ class NumberComparatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('==1KI', array('1024'), array('1023', '1025')),
|
array('==1KI', array('1024'), array('1023', '1025')),
|
||||||
|
|
||||||
array('==1m', array('1000000'), array('999999', '1000001')),
|
array('==1m', array('1000000'), array('999999', '1000001')),
|
||||||
array('==1mi', array(1024*1024), array(1024*1024-1, 1024*1024+1)),
|
array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
|
||||||
|
|
||||||
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
||||||
array('==1gi', array(1024*1024*1024), array(1024*1024*1024-1, 1024*1024*1024+1)),
|
array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
|
||||||
|
|
||||||
array('!= 1000', array('500', '999'), array('1000')),
|
array('!= 1000', array('500', '999'), array('1000')),
|
||||||
);
|
);
|
||||||
|
@ -163,7 +163,7 @@ class ChoiceType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$choiceListCache = & $this->choiceListCache;
|
$choiceListCache = &$this->choiceListCache;
|
||||||
|
|
||||||
$choiceList = function (Options $options) use (&$choiceListCache) {
|
$choiceList = function (Options $options) use (&$choiceListCache) {
|
||||||
// Harden against NULL values (like in EntityType and ModelType)
|
// Harden against NULL values (like in EntityType and ModelType)
|
||||||
|
@ -66,16 +66,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
$this->objectChoices = null;
|
$this->objectChoices = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \PHPUnit_Framework_Error
|
|
||||||
*/
|
|
||||||
public function testChoicesOptionExpectsArray()
|
|
||||||
{
|
|
||||||
$this->factory->create('choice', null, array(
|
|
||||||
'choices' => new \ArrayObject(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
|
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
|
||||||
*/
|
*/
|
||||||
|
@ -111,7 +111,7 @@ class IpUtils
|
|||||||
$bytesTest = unpack('n*', inet_pton($requestIp));
|
$bytesTest = unpack('n*', inet_pton($requestIp));
|
||||||
|
|
||||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
||||||
$left = $netmask - 16 * ($i-1);
|
$left = $netmask - 16 * ($i - 1);
|
||||||
$left = ($left <= 16) ? $left : 16;
|
$left = ($left <= 16) ? $left : 16;
|
||||||
$mask = ~(0xffff >> $left) & 0xffff;
|
$mask = ~(0xffff >> $left) & 0xffff;
|
||||||
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
|
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
|
||||||
|
@ -73,7 +73,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
*/
|
*/
|
||||||
public function set($name, $value)
|
public function set($name, $value)
|
||||||
{
|
{
|
||||||
$attributes = & $this->resolveAttributePath($name, true);
|
$attributes = &$this->resolveAttributePath($name, true);
|
||||||
$name = $this->resolveKey($name);
|
$name = $this->resolveKey($name);
|
||||||
$attributes[$name] = $value;
|
$attributes[$name] = $value;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
public function remove($name)
|
public function remove($name)
|
||||||
{
|
{
|
||||||
$retval = null;
|
$retval = null;
|
||||||
$attributes = & $this->resolveAttributePath($name);
|
$attributes = &$this->resolveAttributePath($name);
|
||||||
$name = $this->resolveKey($name);
|
$name = $this->resolveKey($name);
|
||||||
if (null !== $attributes && array_key_exists($name, $attributes)) {
|
if (null !== $attributes && array_key_exists($name, $attributes)) {
|
||||||
$retval = $attributes[$name];
|
$retval = $attributes[$name];
|
||||||
@ -106,7 +106,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
*/
|
*/
|
||||||
protected function &resolveAttributePath($name, $writeContext = false)
|
protected function &resolveAttributePath($name, $writeContext = false)
|
||||||
{
|
{
|
||||||
$array = & $this->attributes;
|
$array = &$this->attributes;
|
||||||
$name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name;
|
$name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name;
|
||||||
|
|
||||||
// Check if there is anything to do, else return
|
// Check if there is anything to do, else return
|
||||||
@ -125,14 +125,14 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($parts[count($parts)-1]);
|
unset($parts[count($parts) - 1]);
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if (null !== $array && !array_key_exists($part, $array)) {
|
if (null !== $array && !array_key_exists($part, $array)) {
|
||||||
$array[$part] = $writeContext ? array() : null;
|
$array[$part] = $writeContext ? array() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$array = & $array[$part];
|
$array = &$array[$part];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
@ -150,7 +150,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
protected function resolveKey($name)
|
protected function resolveKey($name)
|
||||||
{
|
{
|
||||||
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
|
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
|
||||||
$name = substr($name, $pos+1);
|
$name = substr($name, $pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
@ -119,14 +119,14 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testCookieIsNotCleared()
|
public function testCookieIsNotCleared()
|
||||||
{
|
{
|
||||||
$cookie = new Cookie('foo', 'bar', time()+3600*24);
|
$cookie = new Cookie('foo', 'bar', time() + 3600 * 24);
|
||||||
|
|
||||||
$this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
|
$this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCookieIsCleared()
|
public function testCookieIsCleared()
|
||||||
{
|
{
|
||||||
$cookie = new Cookie('foo', 'bar', time()-20);
|
$cookie = new Cookie('foo', 'bar', time() - 20);
|
||||||
|
|
||||||
$this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
|
$this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');
|
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');
|
||||||
|
|
||||||
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
|
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
|
||||||
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
|
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
|
||||||
|
|
||||||
$cookie = new Cookie('foo', 'bar', 0, '/', '');
|
$cookie = new Cookie('foo', 'bar', 0, '/', '');
|
||||||
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
||||||
|
@ -17,7 +17,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testStore()
|
public function testStore()
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < 10; $i ++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$profile = new Profile('token_'.$i);
|
$profile = new Profile('token_'.$i);
|
||||||
$profile->setIp('127.0.0.1');
|
$profile->setIp('127.0.0.1');
|
||||||
$profile->setUrl('http://foo.bar');
|
$profile->setUrl('http://foo.bar');
|
||||||
|
@ -29,7 +29,7 @@ function strip_minor_versions($version)
|
|||||||
|
|
||||||
function centered($text)
|
function centered($text)
|
||||||
{
|
{
|
||||||
$padding = (int) ((LINE_WIDTH - strlen($text))/2);
|
$padding = (int) ((LINE_WIDTH - strlen($text)) / 2);
|
||||||
|
|
||||||
return str_repeat(' ', $padding).$text;
|
return str_repeat(' ', $padding).$text;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class ProcessBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an unescaped prefix to the command string.
|
* Adds a prefix to the command string.
|
||||||
*
|
*
|
||||||
* The prefix is preserved when resetting arguments.
|
* The prefix is preserved when resetting arguments.
|
||||||
*
|
*
|
||||||
|
@ -55,7 +55,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
$propertyPath = new PropertyPath($propertyPath);
|
$propertyPath = new PropertyPath($propertyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices);
|
$propertyValues = &$this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices);
|
||||||
|
|
||||||
return $propertyValues[count($propertyValues) - 1][self::VALUE];
|
return $propertyValues[count($propertyValues) - 1][self::VALUE];
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
$propertyPath = new PropertyPath($propertyPath);
|
$propertyPath = new PropertyPath($propertyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
$propertyValues = &$this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
|
||||||
|
|
||||||
// Add the root object to the list
|
// Add the root object to the list
|
||||||
array_unshift($propertyValues, array(
|
array_unshift($propertyValues, array(
|
||||||
@ -78,7 +78,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
));
|
));
|
||||||
|
|
||||||
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
|
||||||
$objectOrArray = & $propertyValues[$i][self::VALUE];
|
$objectOrArray = &$propertyValues[$i][self::VALUE];
|
||||||
|
|
||||||
$property = $propertyPath->getElement($i);
|
$property = $propertyPath->getElement($i);
|
||||||
|
|
||||||
@ -220,19 +220,19 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($isIndex) {
|
if ($isIndex) {
|
||||||
$propertyValue = & $this->readIndex($objectOrArray, $property);
|
$propertyValue = &$this->readIndex($objectOrArray, $property);
|
||||||
} else {
|
} else {
|
||||||
$propertyValue = & $this->readProperty($objectOrArray, $property);
|
$propertyValue = &$this->readProperty($objectOrArray, $property);
|
||||||
}
|
}
|
||||||
|
|
||||||
$objectOrArray = & $propertyValue[self::VALUE];
|
$objectOrArray = &$propertyValue[self::VALUE];
|
||||||
|
|
||||||
// the final value of the path must not be validated
|
// the final value of the path must not be validated
|
||||||
if ($i + 1 < $propertyPath->getLength() && !is_object($objectOrArray) && !is_array($objectOrArray)) {
|
if ($i + 1 < $propertyPath->getLength() && !is_object($objectOrArray) && !is_array($objectOrArray)) {
|
||||||
throw new UnexpectedTypeException($objectOrArray, $propertyPath, $i+1);
|
throw new UnexpectedTypeException($objectOrArray, $propertyPath, $i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$propertyValues[] = & $propertyValue;
|
$propertyValues[] = &$propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $propertyValues;
|
return $propertyValues;
|
||||||
@ -262,7 +262,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
|
|
||||||
if (isset($array[$index])) {
|
if (isset($array[$index])) {
|
||||||
if (is_array($array)) {
|
if (is_array($array)) {
|
||||||
$result[self::VALUE] = & $array[$index];
|
$result[self::VALUE] = &$array[$index];
|
||||||
$result[self::IS_REF] = true;
|
$result[self::IS_REF] = true;
|
||||||
} else {
|
} else {
|
||||||
$result[self::VALUE] = $array[$index];
|
$result[self::VALUE] = $array[$index];
|
||||||
@ -317,7 +317,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
} elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
|
} elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
|
||||||
$result[self::VALUE] = $object->$property;
|
$result[self::VALUE] = $object->$property;
|
||||||
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
|
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
|
||||||
$result[self::VALUE] = & $object->$property;
|
$result[self::VALUE] = &$object->$property;
|
||||||
$result[self::IS_REF] = true;
|
$result[self::IS_REF] = true;
|
||||||
} elseif (!$classHasProperty && property_exists($object, $property)) {
|
} elseif (!$classHasProperty && property_exists($object, $property)) {
|
||||||
// Needed to support \stdClass instances. We need to explicitly
|
// Needed to support \stdClass instances. We need to explicitly
|
||||||
@ -325,7 +325,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
// a *protected* property was found on the class, property_exists()
|
// a *protected* property was found on the class, property_exists()
|
||||||
// returns true, consequently the following line will result in a
|
// returns true, consequently the following line will result in a
|
||||||
// fatal error.
|
// fatal error.
|
||||||
$result[self::VALUE] = & $object->$property;
|
$result[self::VALUE] = &$object->$property;
|
||||||
$result[self::IS_REF] = true;
|
$result[self::IS_REF] = true;
|
||||||
} elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
|
} elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
|
||||||
// we call the getter and hope the __call do the job
|
// we call the getter and hope the __call do the job
|
||||||
|
@ -66,8 +66,8 @@ class ApacheUrlMatcher extends UrlMatcher
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (false !== $pos = strpos($name, '_', 9)) {
|
if (false !== $pos = strpos($name, '_', 9)) {
|
||||||
$type = substr($name, 9, $pos-9);
|
$type = substr($name, 9, $pos - 9);
|
||||||
$name = substr($name, $pos+1);
|
$name = substr($name, $pos + 1);
|
||||||
} else {
|
} else {
|
||||||
$type = substr($name, 9);
|
$type = substr($name, 9);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class ApacheMatcherDumper extends MatcherDumper
|
|||||||
$variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique);
|
$variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique);
|
||||||
|
|
||||||
foreach ($compiledRoute->getHostVariables() as $i => $variable) {
|
foreach ($compiledRoute->getHostVariables() as $i => $variable) {
|
||||||
$variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i+1);
|
$variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$variables = implode(',', $variables);
|
$variables = implode(',', $variables);
|
||||||
|
@ -67,7 +67,7 @@ class DumperPrefixCollection extends DumperCollection
|
|||||||
// Prefix starts with route's prefix
|
// Prefix starts with route's prefix
|
||||||
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
|
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
|
||||||
$child = new DumperPrefixCollection();
|
$child = new DumperPrefixCollection();
|
||||||
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix)+1));
|
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix) + 1));
|
||||||
$collection->add($child);
|
$collection->add($child);
|
||||||
|
|
||||||
return $child->addPrefixRoute($route);
|
return $child->addPrefixRoute($route);
|
||||||
|
@ -104,7 +104,7 @@ class AclProvider implements AclProviderInterface
|
|||||||
$currentBatch = array();
|
$currentBatch = array();
|
||||||
$oidLookup = array();
|
$oidLookup = array();
|
||||||
|
|
||||||
for ($i = 0, $c = count($oids); $i<$c; $i++) {
|
for ($i = 0, $c = count($oids); $i < $c; $i++) {
|
||||||
$oid = $oids[$i];
|
$oid = $oids[$i];
|
||||||
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
||||||
$oidLookup[$oidLookupKey] = $oid;
|
$oidLookup[$oidLookupKey] = $oid;
|
||||||
@ -315,7 +315,7 @@ SELECTCLAUSE;
|
|||||||
$this->connection->quote($batch[$i]->getType())
|
$this->connection->quote($batch[$i]->getType())
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($i+1 < $count) {
|
if ($i + 1 < $count) {
|
||||||
$sql .= ' OR ';
|
$sql .= ' OR ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,8 +509,8 @@ QUERY;
|
|||||||
$acls = $aces = $emptyArray = array();
|
$acls = $aces = $emptyArray = array();
|
||||||
$oidCache = $oidLookup;
|
$oidCache = $oidLookup;
|
||||||
$result = new \SplObjectStorage();
|
$result = new \SplObjectStorage();
|
||||||
$loadedAces = & $this->loadedAces;
|
$loadedAces = &$this->loadedAces;
|
||||||
$loadedAcls = & $this->loadedAcls;
|
$loadedAcls = &$this->loadedAcls;
|
||||||
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
|
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
|
||||||
|
|
||||||
// we need these to set protected properties on hydrated objects
|
// we need these to set protected properties on hydrated objects
|
||||||
|
@ -854,7 +854,7 @@ QUERY;
|
|||||||
$sids = new \SplObjectStorage();
|
$sids = new \SplObjectStorage();
|
||||||
$classIds = new \SplObjectStorage();
|
$classIds = new \SplObjectStorage();
|
||||||
foreach ($changes[1] as $field => $new) {
|
foreach ($changes[1] as $field => $new) {
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null === $ace->getId()) {
|
if (null === $ace->getId()) {
|
||||||
@ -928,7 +928,7 @@ QUERY;
|
|||||||
|
|
||||||
$sids = new \SplObjectStorage();
|
$sids = new \SplObjectStorage();
|
||||||
$classIds = new \SplObjectStorage();
|
$classIds = new \SplObjectStorage();
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null === $ace->getId()) {
|
if (null === $ace->getId()) {
|
||||||
@ -969,7 +969,7 @@ QUERY;
|
|||||||
list($old, $new) = $changes;
|
list($old, $new) = $changes;
|
||||||
$currentIds = array();
|
$currentIds = array();
|
||||||
|
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null !== $ace->getId()) {
|
if (null !== $ace->getId()) {
|
||||||
|
@ -399,7 +399,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
*/
|
*/
|
||||||
private function deleteAce($property, $index)
|
private function deleteAce($property, $index)
|
||||||
{
|
{
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
if (!isset($aces[$index])) {
|
if (!isset($aces[$index])) {
|
||||||
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||||
}
|
}
|
||||||
@ -409,8 +409,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
$this->$property = array_values($this->$property);
|
$this->$property = array_values($this->$property);
|
||||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||||
|
|
||||||
for ($i = $index, $c = count($this->$property); $i<$c; $i++) {
|
for ($i = $index, $c = count($this->$property); $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
|
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
*/
|
*/
|
||||||
private function deleteFieldAce($property, $index, $field)
|
private function deleteFieldAce($property, $index, $field)
|
||||||
{
|
{
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
if (!isset($aces[$field][$index])) {
|
if (!isset($aces[$field][$index])) {
|
||||||
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||||
}
|
}
|
||||||
@ -435,8 +435,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
$aces[$field] = array_values($aces[$field]);
|
$aces[$field] = array_values($aces[$field]);
|
||||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||||
|
|
||||||
for ($i = $index, $c = count($aces[$field]); $i<$c; $i++) {
|
for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
|
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
$oldValue = $this->$property;
|
$oldValue = $this->$property;
|
||||||
if (isset($aces[$index])) {
|
if (isset($aces[$index])) {
|
||||||
$this->$property = array_merge(
|
$this->$property = array_merge(
|
||||||
@ -480,8 +480,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
array_slice($this->$property, $index)
|
array_slice($this->$property, $index)
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($i = $index, $c = count($this->$property)-1; $i<$c; $i++) {
|
for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
|
$this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
if (!isset($aces[$field])) {
|
if (!isset($aces[$field])) {
|
||||||
$aces[$field] = array();
|
$aces[$field] = array();
|
||||||
}
|
}
|
||||||
@ -538,8 +538,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
array_slice($aces[$field], $index)
|
array_slice($aces[$field], $index)
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($i = $index, $c = count($aces[$field])-1; $i<$c; $i++) {
|
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
|
$this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
*/
|
*/
|
||||||
private function updateAce($property, $index, $mask, $strategy = null)
|
private function updateAce($property, $index, $mask, $strategy = null)
|
||||||
{
|
{
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
if (!isset($aces[$index])) {
|
if (!isset($aces[$index])) {
|
||||||
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||||
}
|
}
|
||||||
@ -620,7 +620,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
throw new \InvalidArgumentException('$field cannot be empty.');
|
throw new \InvalidArgumentException('$field cannot be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$aces = & $this->$property;
|
$aces = &$this->$property;
|
||||||
if (!isset($aces[$field][$index])) {
|
if (!isset($aces[$field][$index])) {
|
||||||
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class MaskBuilder extends AbstractMaskBuilder
|
|||||||
$length = strlen($pattern);
|
$length = strlen($pattern);
|
||||||
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
|
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
for ($i = $length-1; $i >= 0; $i--) {
|
for ($i = $length - 1; $i >= 0; $i--) {
|
||||||
if ('1' === $bitmask[$i]) {
|
if ('1' === $bitmask[$i]) {
|
||||||
try {
|
try {
|
||||||
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
|
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
|
||||||
|
@ -92,7 +92,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
|
$this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
|
||||||
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
|
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
|
||||||
|
|
||||||
for ($i = 0; $i<40000; $i++) {
|
for ($i = 0; $i < 40000; $i++) {
|
||||||
$this->generateAclHierarchy();
|
$this->generateAclHierarchy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function generateAclLevel($depth, $parentId, $ancestors)
|
protected function generateAclLevel($depth, $parentId, $ancestors)
|
||||||
{
|
{
|
||||||
$level = count($ancestors);
|
$level = count($ancestors);
|
||||||
for ($i = 0, $t = rand(1, 10); $i<$t; $i++) {
|
for ($i = 0, $t = rand(1, 10); $i < $t; $i++) {
|
||||||
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
||||||
|
|
||||||
if ($level < $depth) {
|
if ($level < $depth) {
|
||||||
@ -124,9 +124,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
} else {
|
} else {
|
||||||
return rand(1000, $id-1);
|
return rand(1000, $id - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->generateAces($classId, $id);
|
$this->generateAces($classId, $id);
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function chooseSid()
|
protected function chooseSid()
|
||||||
@ -165,9 +165,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
));
|
));
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
} else {
|
} else {
|
||||||
return rand(1000, $id-1);
|
return rand(1000, $id - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$sid = $this->chooseSid();
|
$sid = $this->chooseSid();
|
||||||
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
|
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
|
||||||
|
|
||||||
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0;
|
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName] + 1 : 0;
|
||||||
if (!isset($sids[$sid])) {
|
if (!isset($sids[$sid])) {
|
||||||
$sids[$sid] = array();
|
$sids[$sid] = array();
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$cLength = strlen($chars);
|
$cLength = strlen($chars);
|
||||||
|
|
||||||
while (strlen($s) < $length) {
|
while (strlen($s) < $length) {
|
||||||
$s .= $chars[mt_rand(0, $cLength-1)];
|
$s .= $chars[mt_rand(0, $cLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
|
@ -231,7 +231,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
$class = get_class($this);
|
$class = get_class($this);
|
||||||
$class = substr($class, strrpos($class, '\\')+1);
|
$class = substr($class, strrpos($class, '\\') + 1);
|
||||||
|
|
||||||
$roles = array();
|
$roles = array();
|
||||||
foreach ($this->roles as $role) {
|
foreach ($this->roles as $role) {
|
||||||
@ -248,7 +248,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->user instanceof EquatableInterface) {
|
if ($this->user instanceof EquatableInterface) {
|
||||||
return ! (bool) $this->user->isEqualTo($user);
|
return !(bool) $this->user->isEqualTo($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->user->getPassword() !== $user->getPassword()) {
|
if ($this->user->getPassword() !== $user->getPassword()) {
|
||||||
|
@ -52,23 +52,6 @@ class RememberMeTokenTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \PHPUnit_Framework_Error
|
|
||||||
* @dataProvider getUserArguments
|
|
||||||
*/
|
|
||||||
public function testConstructorUserCannotBeNull($user)
|
|
||||||
{
|
|
||||||
new RememberMeToken($user, 'foo', 'foo');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserArguments()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
array(null),
|
|
||||||
array('foo'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getUser($roles = array('ROLE_FOO'))
|
protected function getUser($roles = array('ROLE_FOO'))
|
||||||
{
|
{
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
|
@ -49,7 +49,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
$f += $c[$i] * $c[$i];
|
$f += $c[$i] * $c[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$Y = 16/5000 * $f - 5000;
|
$Y = 16 / 5000 * $f - 5000;
|
||||||
|
|
||||||
$this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y);
|
$this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
|
||||||
|
|
||||||
$userProvider
|
$userProvider
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -129,7 +129,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
|
||||||
|
|
||||||
$returnedToken = $service->autoLogin($request);
|
$returnedToken = $service->autoLogin($request);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class ArrayLoader implements LoaderInterface
|
|||||||
private function flatten(array &$messages, array $subnode = null, $path = null)
|
private function flatten(array &$messages, array $subnode = null, $path = null)
|
||||||
{
|
{
|
||||||
if (null === $subnode) {
|
if (null === $subnode) {
|
||||||
$subnode = & $messages;
|
$subnode = &$messages;
|
||||||
}
|
}
|
||||||
foreach ($subnode as $key => $value) {
|
foreach ($subnode as $key => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
|
@ -165,7 +165,7 @@ class PoFileLoader extends ArrayLoader
|
|||||||
end($plurals);
|
end($plurals);
|
||||||
$count = key($plurals);
|
$count = key($plurals);
|
||||||
// Fill missing spots with '-'.
|
// Fill missing spots with '-'.
|
||||||
$empties = array_fill(0, $count+1, '-');
|
$empties = array_fill(0, $count + 1, '-');
|
||||||
$plurals += $empties;
|
$plurals += $empties;
|
||||||
ksort($plurals);
|
ksort($plurals);
|
||||||
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
|
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
|
||||||
|
@ -358,7 +358,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
return array(
|
return array(
|
||||||
array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''),
|
array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''),
|
||||||
array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''),
|
array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''),
|
||||||
array('Symfony est super !', new String('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''),
|
array('Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
|
array('Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
|
||||||
array('Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
|
array('Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
|
||||||
|
|
||||||
array('Il y a 0 pomme', new String('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
|
array('Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +588,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class String
|
class StringClass
|
||||||
{
|
{
|
||||||
protected $str;
|
protected $str;
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class IssnValidator extends ConstraintValidator
|
|||||||
|
|
||||||
for ($i = 0; $i < 7; ++$i) {
|
for ($i = 0; $i < 7; ++$i) {
|
||||||
// Multiply the first digit by 8, the second by 7, etc.
|
// Multiply the first digit by 8, the second by 7, etc.
|
||||||
$checkSum += (8-$i) * $canonical{$i};
|
$checkSum += (8 - $i) * $canonical{$i};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 !== $checkSum % 11) {
|
if (0 !== $checkSum % 11) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="9">
|
<trans-unit id="9">
|
||||||
<source>This field was not expected.</source>
|
<source>This field was not expected.</source>
|
||||||
<target>Ez a mező nem számítottak.</target>
|
<target>Nem várt mező.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="10">
|
<trans-unit id="10">
|
||||||
<source>This field is missing.</source>
|
<source>This field is missing.</source>
|
||||||
@ -306,6 +306,10 @@
|
|||||||
<source>The host could not be resolved.</source>
|
<source>The host could not be resolved.</source>
|
||||||
<target>Az állomásnevet nem lehet feloldani.</target>
|
<target>Az állomásnevet nem lehet feloldani.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="80">
|
||||||
|
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||||
|
<target>Ez az érték nem az elvárt {{ charset }} karakterkódolást használja.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -302,6 +302,14 @@
|
|||||||
<source>An empty file is not allowed.</source>
|
<source>An empty file is not allowed.</source>
|
||||||
<target>Arquivo vazio não é permitido.</target>
|
<target>Arquivo vazio não é permitido.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="79">
|
||||||
|
<source>The host could not be resolved.</source>
|
||||||
|
<target>O host não pôde ser resolvido.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="80">
|
||||||
|
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||||
|
<target>Este valor não corresponde ao charset {{ charset }} esperado.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -165,7 +165,7 @@ abstract class FileValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
*/
|
*/
|
||||||
public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix)
|
public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix)
|
||||||
{
|
{
|
||||||
fseek($this->file, $bytesWritten-1, SEEK_SET);
|
fseek($this->file, $bytesWritten - 1, SEEK_SET);
|
||||||
fwrite($this->file, '0');
|
fwrite($this->file, '0');
|
||||||
fclose($this->file);
|
fclose($this->file);
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ abstract class FileValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
*/
|
*/
|
||||||
public function testMaxSizeNotExceeded($bytesWritten, $limit)
|
public function testMaxSizeNotExceeded($bytesWritten, $limit)
|
||||||
{
|
{
|
||||||
fseek($this->file, $bytesWritten-1, SEEK_SET);
|
fseek($this->file, $bytesWritten - 1, SEEK_SET);
|
||||||
fwrite($this->file, '0');
|
fwrite($this->file, '0');
|
||||||
fclose($this->file);
|
fclose($this->file);
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ class Inline
|
|||||||
case Escaper::requiresDoubleQuoting($value):
|
case Escaper::requiresDoubleQuoting($value):
|
||||||
return Escaper::escapeWithDoubleQuotes($value);
|
return Escaper::escapeWithDoubleQuotes($value);
|
||||||
case Escaper::requiresSingleQuoting($value):
|
case Escaper::requiresSingleQuoting($value):
|
||||||
|
case preg_match(self::getHexRegex(), $value):
|
||||||
case preg_match(self::getTimestampRegex(), $value):
|
case preg_match(self::getTimestampRegex(), $value):
|
||||||
return Escaper::escapeWithSingleQuotes($value);
|
return Escaper::escapeWithSingleQuotes($value);
|
||||||
default:
|
default:
|
||||||
@ -491,6 +492,7 @@ class Inline
|
|||||||
|
|
||||||
return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
|
return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
|
||||||
case is_numeric($scalar):
|
case is_numeric($scalar):
|
||||||
|
case preg_match(self::getHexRegex(), $scalar):
|
||||||
return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
|
return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
|
||||||
case '.inf' === $scalarLower:
|
case '.inf' === $scalarLower:
|
||||||
case '.nan' === $scalarLower:
|
case '.nan' === $scalarLower:
|
||||||
@ -531,4 +533,14 @@ class Inline
|
|||||||
$~x
|
$~x
|
||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a regex that matches a YAML number in hexadecimal notation.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getHexRegex()
|
||||||
|
{
|
||||||
|
return '~^0x[0-9a-f]++$~i';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class Parser
|
|||||||
if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
|
if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
|
||||||
$c = $this->getRealCurrentLineNb() + 1;
|
$c = $this->getRealCurrentLineNb() + 1;
|
||||||
$parser = new Parser($c);
|
$parser = new Parser($c);
|
||||||
$parser->refs = & $this->refs;
|
$parser->refs = &$this->refs;
|
||||||
$data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
$data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
||||||
} else {
|
} else {
|
||||||
if (isset($values['leadspaces'])
|
if (isset($values['leadspaces'])
|
||||||
@ -103,7 +103,7 @@ class Parser
|
|||||||
// this is a compact notation element, add to next block and parse
|
// this is a compact notation element, add to next block and parse
|
||||||
$c = $this->getRealCurrentLineNb();
|
$c = $this->getRealCurrentLineNb();
|
||||||
$parser = new Parser($c);
|
$parser = new Parser($c);
|
||||||
$parser->refs = & $this->refs;
|
$parser->refs = &$this->refs;
|
||||||
|
|
||||||
$block = $values['value'];
|
$block = $values['value'];
|
||||||
if ($this->isNextLineIndented()) {
|
if ($this->isNextLineIndented()) {
|
||||||
@ -160,7 +160,7 @@ class Parser
|
|||||||
}
|
}
|
||||||
$c = $this->getRealCurrentLineNb() + 1;
|
$c = $this->getRealCurrentLineNb() + 1;
|
||||||
$parser = new Parser($c);
|
$parser = new Parser($c);
|
||||||
$parser->refs = & $this->refs;
|
$parser->refs = &$this->refs;
|
||||||
$parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
$parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
||||||
|
|
||||||
if (!is_array($parsed)) {
|
if (!is_array($parsed)) {
|
||||||
@ -211,7 +211,7 @@ class Parser
|
|||||||
} else {
|
} else {
|
||||||
$c = $this->getRealCurrentLineNb() + 1;
|
$c = $this->getRealCurrentLineNb() + 1;
|
||||||
$parser = new Parser($c);
|
$parser = new Parser($c);
|
||||||
$parser->refs = & $this->refs;
|
$parser->refs = &$this->refs;
|
||||||
$value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
$value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap);
|
||||||
// Spec: Keys MUST be unique; first one wins.
|
// Spec: Keys MUST be unique; first one wins.
|
||||||
// But overwriting is allowed when a merge node is used in current block.
|
// But overwriting is allowed when a merge node is used in current block.
|
||||||
|
Reference in New Issue
Block a user