Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type "Psr\Log\NullLogger" is unknown or cannot be used as property default value. #33

Closed
emodric opened this issue May 19, 2023 · 9 comments · Fixed by #34
Closed

Type "Psr\Log\NullLogger" is unknown or cannot be used as property default value. #33

emodric opened this issue May 19, 2023 · 9 comments · Fixed by #34

Comments

@emodric
Copy link

emodric commented May 19, 2023

Hi,

After upgrading this package to 1.0.15, I'm getting the error Type "Psr\Log\NullLogger" is unknown or cannot be used as property default value. in my app.

I have a feeling this is not the fault of this package, but somewhere in my project and I have a hard time tracking this down.

Can anyone point me in direction of solving this? Thanks!

@nicolas-grekas
Copy link
Collaborator

Can you share a reproducer? Or maybe share part of the generated proxy code?

@emodric
Copy link
Author

emodric commented May 19, 2023

Where can I look for it?

The only mention of NullLogger in the cache comes from the service definition for sentry.client

    <service id="sentry.client" class="Sentry\Client">
      <factory method="getClient">
        <service class="Sentry\ClientBuilder">
          <argument type="service" id="sentry.client.options"/>
          <call method="setSdkIdentifier">
            <argument>sentry.php.symfony</argument>
          </call>
          <call method="setSdkVersion">
            <argument>4.8.0</argument>
          </call>
          <call method="setTransportFactory">
            <argument type="service" id="Sentry\Transport\TransportFactoryInterface"/>
          </call>
          <call method="setSerializer">
            <argument type="service">
              <service class="Sentry\Serializer\Serializer">
                <argument type="service" id="sentry.client.options"/>
              </service>
            </argument>
          </call>
          <call method="setRepresentationSerializer">
            <argument type="service">
              <service class="Sentry\Serializer\RepresentationSerializer">
                <argument type="service" id="sentry.client.options"/>
              </service>
            </argument>
          </call>
          <call method="setLogger">
            <argument type="service" id="Psr\Log\NullLogger" on-invalid="ignore"/>
          </call>
        </service>
      </factory>
    </service>

@nicolas-grekas
Copy link
Collaborator

look for Proxy in the var/cache/ folder?

@emodric
Copy link
Author

emodric commented May 19, 2023

There are no proxies generated. I suppose the process breaks due to the error.

I did find some in other projects in var/cache/dev/repository/proxy/, but here it doesn't exist.

@nicolas-grekas
Copy link
Collaborator

I'm going to need more info from your side. Maybe the stack trace of the exception could help you figure out which code breaks?

@emodric
Copy link
Author

emodric commented May 20, 2023

Exception trace I can do, will get it to you as soon as I get near the computer!

@emodric
Copy link
Author

emodric commented May 23, 2023

@nicolas-grekas Here's the exception trace, finally

eddie@abyss ~/www/projects/netgensite (master●●)$ php bin/console cache:clear -vvv

In ValueGenerator.php line 458:
                                                                                     
  [Laminas\Code\Generator\Exception\RuntimeException]                                
  Type "Psr\Log\NullLogger" is unknown or cannot be used as property default value.  
                                                                                     

Exception trace:
  at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/ValueGenerator.php:458
 Laminas\Code\Generator\ValueGenerator->generate() at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/ValueGenerator.php:507
 Laminas\Code\Generator\ValueGenerator->__toString() at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/ParameterGenerator.php:300
 Laminas\Code\Generator\ParameterGenerator->generate() at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/MethodGenerator.php:371
 Laminas\Code\Generator\MethodGenerator::Laminas\Code\Generator\{closure}() at n/a:n/a
 array_map() at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/MethodGenerator.php:372
 Laminas\Code\Generator\MethodGenerator->generate() at /var/www/html/projects/netgensite/vendor/laminas/laminas-code/src/Generator/ClassGenerator.php:1115
 Laminas\Code\Generator\ClassGenerator->generate() at /var/www/html/projects/netgensite/vendor/friendsofphp/proxy-manager-lts/src/ProxyManager/GeneratorStrategy/BaseGeneratorStrategy.php:22
 ProxyManager\GeneratorStrategy\BaseGeneratorStrategy->generate() at /var/www/html/projects/netgensite/vendor/symfony/proxy-manager-bridge/LazyProxy/PhpDumper/ProxyDumper.php:82
 Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper->getProxyCode() at /var/www/html/projects/netgensite/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:581
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->generateProxyClasses() at /var/www/html/projects/netgensite/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:236
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->dump() at /var/www/html/projects/netgensite/vendor/symfony/http-kernel/Kernel.php:734
 Symfony\Component\HttpKernel\Kernel->dumpContainer() at /var/www/html/projects/netgensite/vendor/symfony/http-kernel/Kernel.php:556
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /var/www/html/projects/netgensite/vendor/symfony/http-kernel/Kernel.php:787
 Symfony\Component\HttpKernel\Kernel->preBoot() at /var/www/html/projects/netgensite/vendor/symfony/http-kernel/Kernel.php:128
 Symfony\Component\HttpKernel\Kernel->boot() at /var/www/html/projects/netgensite/vendor/symfony/framework-bundle/Console/Application.php:168
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /var/www/html/projects/netgensite/vendor/symfony/framework-bundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/projects/netgensite/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /var/www/html/projects/netgensite/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /var/www/html/projects/netgensite/vendor/autoload_runtime.php:35
 require_once() at /var/www/html/projects/netgensite/bin/console:11

@nicolas-grekas
Copy link
Collaborator

Fix released in v1.0.16, thanks for the insights.

@emodric
Copy link
Author

emodric commented May 24, 2023

@nicolas-grekas Thanks! Tested and working fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants