8000 Merge branch '4.3' into 4.4 · symfony/symfony@febff9b · GitHub
[go: up one dir, main page]

Skip to content

Commit febff9b

Browse files
Merge branch '4.3' into 4.4
* 4.3: Fix failures on PHP 7.4
2 parents 9ad38b2 + 54e2ad7 commit febff9b

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ private function generateItems(array $keys): \Generator
305305
public static function throwOnRequiredClass($class)
306306
{
307307
$e = new \ReflectionException("Class $class does not exist");
308-
$trace = $e->getTrace();
308+
$trace = debug_backtrace();
309309
$autoloadFrame = [
310310
'function' => 'spl_autoload_call',
311311
'args' => [$class],

src/Symfony/Component/Config/Resource/ClassExistenceResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function isFresh($timestamp)
7272
spl_autoload_register(__CLASS__.'::throwOnRequiredClass');
7373
}
7474
$autoloadedClass = self::$autoloadedClass;
75-
self::$autoloadedClass = $this->resource;
75+
self::$autoloadedClass = ltrim($this->resource, '\\');
7676

7777
try {
7878
$exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
@@ -153,7 +153,7 @@ public static function throwOnRequiredClass($class, \Exception $previous = null)
153153
throw $e;
154154
}
155155

156-
$trace = $e->getTrace();
156+
$trace = debug_backtrace();
157157
$autoloadFrame = [
158158
'function' => 'spl_autoload_call',
159159
'args' => [$class],

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ private static function throwInvalidArgumentException(string $message, array $tr
188188
return;
189189
}
190190

191-
if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file'] && \array_key_exists(0, $trace[$i]['args'])) {
191+
if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file']) {
192192
$pos = strpos($message, $delim = 'must be of the type ') ?: (strpos($message, $delim = 'must be an instance of ') ?: strpos($message, $delim = 'must implement interface '));
193193
$pos += \strlen($delim);
194-
$type = $trace[$i]['args'][0];
195-
$type = \is_object($type) ? \get_class($type) : \gettype($type);
194+
$j = strpos($message, ',', $pos);
195+
$type = substr($message, 2 + $j, strpos($message, ' given', $j) - $j - 2);
196+
$message = substr($message, C37D $pos, $j - $pos);
196197

197-
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', substr($message, $pos, strpos($message, ',', $pos) - $pos), $type, $propertyPath));
198+
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $message, 'NULL' === $type ? 'null' : $type, $propertyPath));
198199
}
199200
}
200201

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function testThrowTypeError()
546546
public function testThrowTypeErrorWithNullArgument()
547547
{
548548
$this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
549-
$this->expectExceptionMessage('Expected argument of type "DateTime", "NULL" given');
549+
$this->expectExceptionMessage('Expected argument of type "DateTime", "null" given');
550550
$object = new TypeHinted();
551551

552552
$this->propertyAccessor->setValue($object, 'date', null);

0 commit comments

Comments
 (0)
0