summaryrefslogtreecommitdiff
path: root/vendor/symfony/var-exporter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/var-exporter')
-rw-r--r--vendor/symfony/var-exporter/Exception/NotInstantiableTypeException.php4
-rw-r--r--vendor/symfony/var-exporter/Internal/Exporter.php4
-rw-r--r--vendor/symfony/var-exporter/Internal/Registry.php14
3 files changed, 16 insertions, 6 deletions
diff --git a/vendor/symfony/var-exporter/Exception/NotInstantiableTypeException.php b/vendor/symfony/var-exporter/Exception/NotInstantiableTypeException.php
index 7ca4884596..771ee612db 100644
--- a/vendor/symfony/var-exporter/Exception/NotInstantiableTypeException.php
+++ b/vendor/symfony/var-exporter/Exception/NotInstantiableTypeException.php
@@ -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);
}
}
diff --git a/vendor/symfony/var-exporter/Internal/Exporter.php b/vendor/symfony/var-exporter/Internal/Exporter.php
index a737012d15..0c6d8dd746 100644
--- a/vendor/symfony/var-exporter/Internal/Exporter.php
+++ b/vendor/symfony/var-exporter/Internal/Exporter.php
@@ -117,7 +117,7 @@ class Exporter
if (method_exists($class, '__sleep')) {
if (!\is_array($sleep = $value->__sleep())) {
- trigger_error('serialize(): __sleep should return an array only containing the names of instance-variables to serialize', E_USER_NOTICE);
+ trigger_error('serialize(): __sleep should return an array only containing the names of instance-variables to serialize', \E_USER_NOTICE);
$value = null;
goto handle_value;
}
@@ -162,7 +162,7 @@ class Exporter
if ($sleep) {
foreach ($sleep as $n => $v) {
if (false !== $v) {
- trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), E_USER_NOTICE);
+ trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), \E_USER_NOTICE);
}
}
}
diff --git a/vendor/symfony/var-exporter/Internal/Registry.php b/vendor/symfony/var-exporter/Internal/Registry.php
index 19d91c9304..49f3c4833a 100644
--- a/vendor/symfony/var-exporter/Internal/Registry.php
+++ b/vendor/symfony/var-exporter/Internal/Registry.php
@@ -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'))) {