-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
Originally issue came from the Magento 2: magento/magento2#30575
We faced an issue with auto-generated proxy code based on the \Psr\Log\LoggerInterface.
Investigation shown that actually issue was caused by psr php extension - seems like default value isn't specified, while on original LoggerInterface we do have optional context argument wit default value - empty array.
Tested on php 7.3 and php 7.4, both versions having the same issue.
I was able to reproduce this issue even on a simple file (checked on emergency method, but issue the same for others):
<?php
include "./vendor/autoload.php";
$reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency");
$reflectionParameter = $reflectionMethod->getParameters()[1];
var_dump($reflectionParameter->isOptional());
var_dump($reflectionParameter->isDefaultValueAvailable());
var_dump($reflectionParameter->getDefaultValue());and psr/log installed through composer.
Expected result
✔ Result without psr extension
app@3bedbfa9e5db:~/html/pub$ php index.php
bool(true)
bool(true)
array(0) {
}
Actual result
❌ Result with psr extension
app@3bedbfa9e5db:~/html/pub$ php index.php
bool(true)
bool(false)
Fatal error: Uncaught ReflectionException: Cannot determine default value for internal functions in /var/www/html/pub/index.php:8
Stack trace:
#0 /var/www/html/pub/index.php(8): ReflectionParameter->getDefaultValue()
#1 {main}
thrown in /var/www/html/pub/index.php on line 8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels