You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As this helper relies on the convertToPHPValue return type (very clever btw) it will crash if the return value is set to mixed. This can be replicated with any custom doctrine type that is set in the application, with the following stack trace.
in BuilderHelpers.php line 208:
[LogicException]
mixed type cannot be nullable
Exception trace:
at /var/www/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php:208PhpParser\BuilderHelpers::normalizeType() at /var/www/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php:127PhpParser\Builder\Property->setType() at /var/www/vendor/symfony/maker-bundle/src/Util/ClassSourceManipulator.php:402Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator->addProperty() at /var/www/vendor/symfony/maker-bundle/src/Util/ClassSourceManipulator.php:151Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator->addEntityField() at /var/www/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php:243Symfony\Bundle\MakerBundle\Maker\MakeEntity->generate() at /var/www/vendor/symfony/maker-bundle/src/Command/MakerCommand.php:102Symfony\Bundle\MakerBundle\Command\MakerCommand->execute() at /var/www/vendor/symfony/console/Command/Command.php:326
It appears that the builder tries to make a field with type mixed|null or ?mixed but mixed already implicitly includes null, which causes the error.
After updating the return type for our custom type from mixed to a more sensible string|null the error has stopped. Maybe in such a case a note should be printed to cli?
The text was updated successfully, but these errors were encountered:
As I've pointed out above, you can trigger the crash by changing the return type of convertToPHPValue to mixed on the doctrine type class you're using while selecting the field.
For example, you could modify the built-in string column type for doctrine to return that from said method. A crash should occur then.
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I'm able to reliably crash the
make:entity
command on 1.61 because of the following line:maker-bundle/src/Doctrine/DoctrineHelper.php
Line 291 in ce60831
As this helper relies on the
convertToPHPValue
return type (very clever btw) it will crash if the return value is set tomixed
. This can be replicated with any custom doctrine type that is set in the application, with the following stack trace.It appears that the builder tries to make a field with type
mixed|null
or?mixed
butmixed
already implicitly includes null, which causes the error.After updating the return type for our custom type from
mixed
to a more sensiblestring|null
the error has stopped. Maybe in such a case a note should be printed to cli?The text was updated successfully, but these errors were encountered: