Merge branch '4.4' into 5.1

* 4.4:
  [Debug] fix test
  consistently use same types for strict comparisons
  [PhpUnitBridge] Skip internal classes in CoverageListenerTrait
  [VarExporter] unserialize() might throw an Exception on php 8.
  [ErrorHandler] Parse "x not found" errors correctly on php 8.
  Prevent parsing invalid octal digits as octal numbers
  remove unnecessary check for  existing request
  [DI] fix ContainerBuilder on PHP8
  [Console] Make sure $maxAttempts is an int or null.
  [VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
  [Intl] Skip test cases that produce a TypeError on php 8.
  [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
  [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
  add bosnian (bs) translation
  [Debug] Parse "x not found" errors correctly on php 8.
This commit is contained in:
Nicolas Grekas 2020-09-08 16:19:54 +02:00
commit 62a4559619
15 changed files with 509 additions and 75 deletions

View File

@ -107,6 +107,13 @@ class CoverageListenerTrait
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
$symbolAnnotations->setAccessible(true);
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
$covers = array_filter($covers, function ($class) {
$reflector = new ReflectionClass($class);
return $reflector->isUserDefined();
});
$symbolAnnotations->setValue($docBlock, array_replace($docBlock->symbolAnnotations(), [
'covers' => $covers,
]));

View File

@ -27,13 +27,19 @@ class CoverageListenerTest extends TestCase
$dir = __DIR__.'/../Tests/Fixtures/coverage';
$phpunit = $_SERVER['argv'][0];
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
$output = implode("\n", $output);
$this->assertStringContainsString('FooCov', $output);
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+100.00%[^\n]+Lines:\s+100.00%/', $output);
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
$output = implode("\n", $output);
$this->assertStringNotContainsString('FooCov', $output);
if (false === strpos($output, 'FooCov')) {
$this->addToAssertionCount(1);
} else {
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+0.00%[^\n]+Lines:\s+0.00%/', $output);
}
$this->assertStringContainsString("SutNotFoundTest::test\nCould not find the tested class.", $output);
$this->assertStringNotContainsString("CoversTest::test\nCould not find the tested class.", $output);
$this->assertStringNotContainsString("CoversDefaultClassTest::test\nCould not find the tested class.", $output);

View File

@ -213,8 +213,11 @@ class Question
*/
public function setMaxAttempts(?int $attempts)
{
if (null !== $attempts && $attempts < 1) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
if (null !== $attempts) {
$attempts = (int) $attempts;
if ($attempts < 1) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
}
}
$this->attempts = $attempts;

View File

@ -1088,7 +1088,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
} else {
$r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass()));
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs(array_values($arguments));
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);

View File

@ -716,7 +716,7 @@ class XmlFileLoaderTest extends TestCase
sort($ids);
$this->assertSame([Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids);
$resources = $container->getResources();
$resources = array_map('strval', $container->getResources());
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->assertContains((string) new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources);
@ -734,7 +734,6 @@ class XmlFileLoaderTest extends TestCase
]
);
$this->assertContains((string) $globResource, $resources);
$resources = array_map('strval', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources);
}
@ -749,7 +748,7 @@ class XmlFileLoaderTest extends TestCase
sort($ids);
$this->assertSame([Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids);
$resources = $container->getResources();
$resources = array_map('strval', $container->getResources());
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->assertContains((string) new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype_array.xml'), $resources);
@ -767,7 +766,6 @@ class XmlFileLoaderTest extends TestCase
]
);
$this->assertContains((string) $globResource, $resources);
$resources = array_map('strval', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources);
}

View File

@ -445,7 +445,7 @@ class YamlFileLoaderTest extends TestCase
sort($ids);
$this->assertSame([Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids);
$resources = $container->getResources();
$resources = array_map('strval', $container->getResources());
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->assertContains((string) new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources);
@ -462,7 +462,6 @@ class YamlFileLoaderTest extends TestCase
]
);
$this->assertContains((string) $globResource, $resources);
$resources = array_map('strval', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources);
}

View File

@ -28,50 +28,34 @@ class ClassNotFoundErrorEnhancer implements ErrorEnhancerInterface
{
// Some specific versions of PHP produce a fatal error when extending a not found class.
$message = !$error instanceof FatalError ? $error->getMessage() : $error->getError()['message'];
$messageLen = \strlen($message);
$notFoundSuffix = '\' not found';
$notFoundSuffixLen = \strlen($notFoundSuffix);
if ($notFoundSuffixLen > $messageLen) {
if (!preg_match('/^(Class|Interface|Trait) [\'"]([^\'"]+)[\'"] not found$/', $message, $matches)) {
return null;
}
$typeName = strtolower($matches[1]);
$fullyQualifiedClassName = $matches[2];
if (0 !== substr_compare($message, $notFoundSuffix, -$notFoundSuffixLen)) {
return null;
if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
$className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
$namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
$message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
$tail = ' for another namespace?';
} else {
$className = $fullyQualifiedClassName;
$message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
$tail = '?';
}
foreach (['class', 'interface', 'trait'] as $typeName) {
$prefix = ucfirst($typeName).' \'';
$prefixLen = \strlen($prefix);
if (0 !== strpos($message, $prefix)) {
continue;
}
$fullyQualifiedClassName = substr($message, $prefixLen, -$notFoundSuffixLen);
if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
$className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
$namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
$message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
$tail = ' for another namespace?';
if ($candidates = $this->getClassCandidates($className)) {
$tail = array_pop($candidates).'"?';
if ($candidates) {
$tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
} else {
$className = $fullyQualifiedClassName;
$message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
$tail = '?';
$tail = ' for "'.$tail;
}
if ($candidates = $this->getClassCandidates($className)) {
$tail = array_pop($candidates).'"?';
if ($candidates) {
$tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
} else {
$tail = ' for "'.$tail;
}
}
$message .= "\nDid you forget a \"use\" statement".$tail;
return new ClassNotFoundError($message, $error);
}
$message .= "\nDid you forget a \"use\" statement".$tail;
return null;
return new ClassNotFoundError($message, $error);
}
/**

View File

@ -81,14 +81,30 @@ class ClassNotFoundErrorEnhancerTest extends TestCase
$debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']);
return [
[
'Class "WhizBangFactory" not found',
"Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?",
],
[
'Class \'WhizBangFactory\' not found',
"Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?",
],
[
'Class "Foo\\Bar\\WhizBangFactory" not found',
"Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
],
[
'Class \'Foo\\Bar\\WhizBangFactory\' not found',
"Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
],
[
'Interface "Foo\\Bar\\WhizBangInterface" not found',
"Attempted to load interface \"WhizBangInterface\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
],
[
'Trait "Foo\\Bar\\WhizBangTrait" not found',
"Attempted to load trait \"WhizBangTrait\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
],
[
'Class \'UndefinedFunctionError\' not found',
"Attempted to load class \"UndefinedFunctionError\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\ErrorHandler\Error\UndefinedFunctionError\"?",

View File

@ -377,13 +377,16 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function formatFractionDigitsProvider()
{
return [
[1.123, '1.123', null, 0],
[1.123, '1', 0, 0],
[1.123, '1.1', 1, 1],
[1.123, '1.12', 2, 2],
[1.123, '1.123', -1, 0],
];
yield [1.123, '1.123', null, 0];
yield [1.123, '1', 0, 0];
yield [1.123, '1.1', 1, 1];
yield [1.123, '1.12', 2, 2];
yield [1.123, '1.123', -1, 0];
if (\PHP_VERSION_ID < 80000) {
// This dataset will produce a TypeError on php 8.
yield [1.123, '1', 'abc', 0];
}
}
/**
@ -409,13 +412,16 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function formatGroupingUsedProvider()
{
return [
[1000, '1,000', null, 1],
[1000, '1000', 0, 0],
[1000, '1,000', 1, 1],
[1000, '1,000', 2, 1],
[1000, '1,000', -1, 1],
];
yield [1000, '1,000', null, 1];
yield [1000, '1000', 0, 0];
yield [1000, '1,000', 1, 1];
yield [1000, '1,000', 2, 1];
yield [1000, '1,000', -1, 1];
if (\PHP_VERSION_ID < 80000) {
// This dataset will produce a TypeError on php 8.
yield [1000, '1000', 'abc', 0];
}
}
/**

View File

@ -0,0 +1,391 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>This value should be false.</source>
<target>Ova vrijednost bi trebalo da bude "netačno" (false).</target>
</trans-unit>
<trans-unit id="2">
<source>This value should be true.</source>
<target>Ova vrijednost bi trebalo da bude "tačno" (true).</target>
</trans-unit>
<trans-unit id="3">
<source>This value should be of type {{ type }}.</source>
<target>Ova vrijednost bi trebalo da bude tipa {{ type }}.</target>
</trans-unit>
<trans-unit id="4">
<source>This value should be blank.</source>
<target>Ova vrijednost bi trebalo da bude prazna.</target>
</trans-unit>
<trans-unit id="5">
<source>The value you selected is not a valid choice.</source>
<target>Odabrana vrijednost nije validan izbor.</target>
</trans-unit>
<trans-unit id="6">
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
<target>Morate odabrati barem {{ limit }} mogućnost.|Morate odabrati barem {{ limit }} mogućnosti.|Morate odabrati barem {{ limit }} mogućnosti. </target>
</trans-unit>
<trans-unit id="7">
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
<target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.|Morate odabrati najviše {{ limit }} mogućnosti.</target>
</trans-unit>
<trans-unit id="8">
<source>One or more of the given values is invalid.</source>
<target>Jedna ili više datih vrijednosti nisu validne.</target>
</trans-unit>
<trans-unit id="9">
<source>This field was not expected.</source>
<target>Ovo polje nije očekivano.</target>
</trans-unit>
<trans-unit id="10">
<source>This field is missing.</source>
<target>Ovo polje nedostaje.</target>
</trans-unit>
<trans-unit id="11">
<source>This value is not a valid date.</source>
<target>Ova vrijednost nije ispravan datum.</target>
</trans-unit>
<trans-unit id="12">
<source>This value is not a valid datetime.</source>
<target>Ova vrijednost nije ispravnog datum-vrijeme (datetime) formata.</target>
</trans-unit>
<trans-unit id="13">
<source>This value is not a valid email address.</source>
<target>Ova vrijednost nije ispravna e-mail adresa.</target>
</trans-unit>
<trans-unit id="14">
<source>The file could not be found.</source>
<target>Ova datoteka ne može biti pronađena.</target>
</trans-unit>
<trans-unit id="15">
<source>The file is not readable.</source>
<target>Ova datoteka nije čitljiva.</target>
</trans-unit>
<trans-unit id="16">
<source>The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.</source>
<target>Ova datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veličina je {{ limit }} {{ suffix }}.</target>
</trans-unit>
<trans-unit id="17">
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.</source>
<target>Mime tip datoteke nije ispravan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}.</target>
</trans-unit>
<trans-unit id="18">
<source>This value should be {{ limit }} or less.</source>
<target>Ova vrijednost bi trebalo da bude {{ limit }} ili manje.</target>
</trans-unit>
<trans-unit id="19">
<source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source>
<target>Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.|Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.</target>
</trans-unit>
<trans-unit id="20">
<source>This value should be {{ limit }} or more.</source>
<target>Ova vrijednost bi trebalo da bude {{ limit }} ili više.</target>
</trans-unit>
<trans-unit id="21">
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
<target>Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.|Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.</target>
</trans-unit>
<trans-unit id="22">
<source>This value should not be blank.</source>
<target>Ova vrijednost ne bi trebalo da bude prazna.</target>
</trans-unit>
<trans-unit id="23">
<source>This value should not be null.</source>
<target>Ova vrijednost ne bi trebalo da bude null.</target>
</trans-unit>
<trans-unit id="24">
<source>This value should be null.</source>
<target>Ova vrijednost bi trebalo da bude null.</target>
</trans-unit>
<trans-unit id="25">
<source>This value is not valid.</source>
<target>Ova vrijednost nije ispravna.</target>
</trans-unit>
<trans-unit id="26">
<source>This value is not a valid time.</source>
<target>Ova vrijednost nije ispravno vrijeme.</target>
</trans-unit>
<trans-unit id="27">
<source>This value is not a valid URL.</source>
<target>Ova vrijednost nije ispravan URL.</target>
</trans-unit>
<trans-unit id="31">
<source>The two values should be equal.</source>
<target>Obje vrijednosti bi trebalo da budu jednake.</target>
</trans-unit>
<trans-unit id="32">
<source>The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.</source>
<target>Ova datoteka je prevelika. Najveća dozvoljena veličina je {{ limit }} {{ suffix }}.</target>
</trans-unit>
<trans-unit id="33">
<source>The file is too large.</source>
<target>Ova datoteka je prevelika.</target>
</trans-unit>
<trans-unit id="34">
<source>The file could not be uploaded.</source>
<target>Ova datoteka ne može biti prenijeta (uploaded).</target>
</trans-unit>
<trans-unit id="35">
<source>This value should be a valid number.</source>
<target>Ova vrijednost bi trebalo da bude ispravan broj.</target>
</trans-unit>
<trans-unit id="36">
<source>This file is not a valid image.</source>
<target>Ova datoteka nije validna slika.</target>
</trans-unit>
<trans-unit id="37">
<source>This is not a valid IP address.</source>
<target>Ovo nije ispravna IP adresa.</target>
</trans-unit>
<trans-unit id="38">
<source>This value is not a valid language.</source>
<target>Ova vrijednost nije validan jezik.</target>
</trans-unit>
<trans-unit id="39">
<source>This value is not a valid locale.</source>
<target>Ova vrijednost nije validna regionalna oznaka.</target>
</trans-unit>
<trans-unit id="40">
<source>This value is not a valid country.</source>
<target>Ova vrijednost nije validna država.</target>
</trans-unit>
<trans-unit id="41">
<source>This value is already used.</source>
<target>Ova vrijednost je već upotrebljena.</target>
</trans-unit>
<trans-unit id="42">
<source>The size of the image could not be detected.</source>
<target>Nije moguće otkriti veličinu ove slike.</target>
</trans-unit>
<trans-unit id="43">
<source>The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.</source>
<target>Širina slike je prevelika ({{ width }}px). Najveća dozvoljena širina je {{ max_width }}px.</target>
</trans-unit>
<trans-unit id="44">
<source>The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.</source>
<target>Širina slike je premala ({{ width }}px). Najmanja dozvoljena širina je {{ min_width }}px.</target>
</trans-unit>
<trans-unit id="45">
<source>The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.</source>
<target>Dužina slike je prevelika ({{ height }}px). Najveća dozvoljena dužina je {{ max_height }}px.</target>
</trans-unit>
<trans-unit id="46">
<source>The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.</source>
<target>Dužina slike je premala ({{ height }}px). Najmanja dozvoljena dužina je {{ min_height }}px.</target>
</trans-unit>
<trans-unit id="47">
<source>This value should be the user's current password.</source>
<target>Ova vrijednost bi trebalo da bude trenutna korisnička lozinka.</target>
</trans-unit>
<trans-unit id="48">
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
<target>Ova vrijednost bi trebalo da ima tačno {{ limit }} karakter.|Ova vrijednost bi trebalo da ima tačno {{ limit }} karaktera.</target>
</trans-unit>
<trans-unit id="49">
<source>The file was only partially uploaded.</source>
<target>Datoteka je samo djelimično prenijeta (uploaded).</target>
</trans-unit>
<trans-unit id="50">
<source>No file was uploaded.</source>
<target>Nijedna datoteka nije prenijeta (uploaded).</target>
</trans-unit>
<trans-unit id="51">
<source>No temporary folder was configured in php.ini.</source>
<target>Privremeni direktorijum nije konfigurisan u datoteci php.ini.</target>
</trans-unit>
<trans-unit id="52">
<source>Cannot write temporary file to disk.</source>
<target>Privremenu datoteku nije moguće upisati na disk.</target>
</trans-unit>
<trans-unit id="53">
<source>A PHP extension caused the upload to fail.</source>
<target>Prenos datoteke nije uspio zbog PHP ekstenzije.</target>
</trans-unit>
<trans-unit id="54">
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.</target>
</trans-unit>
<trans-unit id="55">
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.</target>
</trans-unit>
<trans-unit id="56">
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
<target>Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elementa.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata.</target>
</trans-unit>
<trans-unit id="57">
<source>Invalid card number.</source>
<target>Broj kartice je neispravan.</target>
</trans-unit>
<trans-unit id="58">
<source>Unsupported card type or invalid card number.</source>
<target>Tip kartice nije podržan ili je broj kartice neispravan.</target>
</trans-unit>
<trans-unit id="59">
<source>This is not a valid International Bank Account Number (IBAN).</source>
<target>Ova vrijednost nije ispravan međunarodni broj bankovnog računa (IBAN).</target>
</trans-unit>
<trans-unit id="60">
<source>This value is not a valid ISBN-10.</source>
<target>Ova vrijednost nije ispravan ISBN-10.</target>
</trans-unit>
<trans-unit id="61">
<source>This value is not a valid ISBN-13.</source>
<target>Ova vrijednost nije ispravan ISBN-13.</target>
</trans-unit>
<trans-unit id="62">
<source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source>
<target>Ova vrijednost nije ispravan ISBN-10 niti ISBN-13.</target>
</trans-unit>
<trans-unit id="63">
<source>This value is not a valid ISSN.</source>
<target>Ova vrijednost nije ispravan ISSN.</target>
</trans-unit>
<trans-unit id="64">
<source>This value is not a valid currency.</source>
<target>Ova vrijednost nije ispravna valuta.</target>
</trans-unit>
<trans-unit id="65">
<source>This value should be equal to {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude jednaka {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="66">
<source>This value should be greater than {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude veća od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="67">
<source>This value should be greater than or equal to {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude jednaka ili veća od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="68">
<source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude identična {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="69">
<source>This value should be less than {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude manja od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="70">
<source>This value should be less than or equal to {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude jednaka ili manja od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="71">
<source>This value should not be equal to {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude različita od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="72">
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude identična sa {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="73">
<source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source>
<target>Razmjera ove slike je prevelika ({{ ratio }}). Maksimalna dozvoljena razmjera je {{ max_ratio }}.</target>
</trans-unit>
<trans-unit id="74">
<source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source>
<target>Razmjera ove slike je premala ({{ ratio }}). Minimalna očekivana razmjera je {{ min_ratio }}.</target>
</trans-unit>
<trans-unit id="75">
<source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source>
<target>Ova slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene.</target>
</trans-unit>
<trans-unit id="76">
<source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source>
<target>Ova slika je orijentisana horizontalno (landscape) ({{ width }}x{{ height }}px). Horizontalno orijentisane slike nisu dozvoljene.</target>
</trans-unit>
<trans-unit id="77">
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
<target>Ova slika je orijentisana vertikalno (portrait) ({{ width }}x{{ height }}px). Vertikalno orijentisane slike nisu dozvoljene.</target>
</trans-unit>
<trans-unit id="78">
<source>An empty file is not allowed.</source>
<target>Prazna datoteka nije dozvoljena.</target>
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>Nije moguće odrediti poslužitelja (host).</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Ova vrijednost ne odgovara očekivanom {{ charset }} setu karaktera (charset).</target>
</trans-unit>
<trans-unit id="81">
<source>This is not a valid Business Identifier Code (BIC).</source>
<target>Ovo nije validan poslovni identifikacioni kod (BIC).</target>
</trans-unit>
<trans-unit id="82">
<source>Error</source>
<target>Greška</target>
</trans-unit>
<trans-unit id="83">
<source>This is not a valid UUID.</source>
<target>Ovo nije validan UUID.</target>
</trans-unit>
<trans-unit id="84">
<source>This value should be a multiple of {{ compared_value }}.</source>
<target>Ova vrijednost bi trebalo da bude djeljiva sa {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="85">
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Ovaj poslovni identifikacioni kod (BIC) nije povezan sa IBAN-om {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Ova vrijednost bi trebalo da bude validan JSON.</target>
</trans-unit>
<trans-unit id="87">
<source>This collection should contain only unique elements.</source>
<target>Ova kolekcija bi trebala da sadrži samo jedinstvene elemente.</target>
</trans-unit>
<trans-unit id="88">
<source>This value should be positive.</source>
<target>Ova vrijednost bi trebalo da bude pozitivna.</target>
</trans-unit>
<trans-unit id="89">
<source>This value should be either positive or zero.</source>
<target>Ova vrijednost bi trebalo da bude pozitivna ili jednaka nuli.</target>
</trans-unit>
<trans-unit id="90">
<source>This value should be negative.</source>
<target>Ova vrijednost bi trebalo da bude negativna.</target>
</trans-unit>
<trans-unit id="91">
<source>This value should be either negative or zero.</source>
<target>Ova vrijednost bi trebalo da bude negativna ili jednaka nuli.</target>
</trans-unit>
<trans-unit id="92">
<source>This value is not a valid timezone.</source>
<target>Ova vrijednost nije validna vremenska zona.</target>
</trans-unit>
<trans-unit id="93">
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>Ova lozinka je procurila u nekom od slučajeva kompromitovanja podataka, nemojte je koristiti. Koristite drugu lozinku.</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ova vrijednosti bi trebala biti između {{ min }} i {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Ova vrijednost nije ispravno ime poslužitelja (hostname).</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Broj elemenata u ovoj kolekciji bi trebalo da bude djeljiv sa {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ova vrijednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Svaki element ove kolekcije bi trebalo da zadovolji sopstveni skup ograničenja.</target>
</trans-unit>
<trans-unit id="99">
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
<target>Ova vrijednost nije ispravna međunarodna identifikaciona oznaka hartija od vrijednosti (ISIN).</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -94,10 +94,24 @@ class SplCaster
unset($a["\0SplFileInfo\0fileName"]);
unset($a["\0SplFileInfo\0pathName"]);
if (false === $c->getPathname()) {
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
if (\PHP_VERSION_ID < 80000) {
if (false === $c->getPathname()) {
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
return $a;
}
} else {
try {
$c->isReadable();
} catch (\RuntimeException $e) {
if ('Object not initialized' !== $e->getMessage()) {
throw $e;
}
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
}
}
foreach ($map as $key => $accessor) {

View File

@ -13,8 +13,8 @@ namespace Symfony\Component\VarExporter\Exception;
class NotInstantiableTypeException extends \Exception implements ExceptionInterface
{
public function __construct(string $type)
public function __construct(string $type, \Throwable $previous = null)
{
parent::__construct(sprintf('Type "%s" is not instantiable.', $type));
parent::__construct(sprintf('Type "%s" is not instantiable.', $type), 0, $previous);
}
}

View File

@ -89,8 +89,18 @@ class Registry
$proto = $reflector->implementsInterface('Serializable') && !method_exists($class, '__unserialize') ? 'C:' : 'O:';
if ('C:' === $proto && !$reflector->getMethod('unserialize')->isInternal()) {
$proto = null;
} elseif (false === $proto = @unserialize($proto.\strlen($class).':"'.$class.'":0:{}')) {
throw new NotInstantiableTypeException($class);
} else {
try {
$proto = @unserialize($proto.\strlen($class).':"'.$class.'":0:{}');
} catch (\Exception $e) {
if (__FILE__ !== $e->getFile()) {
throw $e;
}
throw new NotInstantiableTypeException($class, $e);
}
if (false === $proto) {
throw new NotInstantiableTypeException($class);
}
}
}
if (null !== $proto && !$proto instanceof \Throwable && !$proto instanceof \Serializable && !method_exists($class, '__sleep') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__serialize'))) {

View File

@ -650,20 +650,20 @@ class Inline
switch (true) {
case ctype_digit($scalar):
if ('0' === $scalar[0] && '0' !== $scalar) {
if (preg_match('/^0[0-7]+$/', $scalar)) {
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0.');
return octdec(preg_replace('/[^0-7]/', '', $scalar));
return octdec($scalar);
}
$cast = (int) $scalar;
return ($scalar === (string) $cast) ? $cast : $scalar;
case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
if ('0' === $scalar[1] && '-0' !== $scalar) {
if (preg_match('/^-0[0-7]+$/', $scalar)) {
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0.');
return -octdec(preg_replace('/[^0-7]/', '', substr($scalar, 1)));
return -octdec(substr($scalar, 1));
}
$cast = (int) $scalar;

View File

@ -826,7 +826,7 @@ class InlineTest extends TestCase
*/
public function testParsePositiveOctalNumberContainingInvalidDigits()
{
self::assertSame(342391, Inline::parse('0123456789'));
self::assertSame('0123456789', Inline::parse('0123456789'));
}
/**
@ -834,7 +834,7 @@ class InlineTest extends TestCase
*/
public function testParseNegativeOctalNumberContainingInvalidDigits()
{
self::assertSame(-342391, Inline::parse('-0123456789'));
self::assertSame('-0123456789', Inline::parse('-0123456789'));
}
/**