PHP8 Compatibility - TypeError: mb_substr(): Argument #3 ($length) must be of type ?int, null given
PhilETaylor opened this issue · comments
Edit: So for hours now I have been trying to get to the bottom of this to give you more details.
All I have managed to find out is that it only effects PHP 8 RC3 when JIT Enabled.
It doesn't always happen either... I cannot get a reliable reproducer - except that when I deploy to production it reproduces within moments and kills my live service.
I cannot replicate ever - even in production - when PHP preloading & JIT is disabled.
constant_time_encoding/src/Binary.php
Line 76 in 751efde
TypeError: mb_substr(): Argument #3 ($length) must be of type ?int, null given
#34 /vendor/paragonie/constant_time_encoding/src/Binary.php(76): mb_substr
#33 /vendor/paragonie/constant_time_encoding/src/Binary.php(76): ParagonIE\ConstantTime\Binary::safeSubstr
#32 /vendor/paragonie/hidden-string/src/HiddenString.php(173): ParagonIE\HiddenString\HiddenString::safeStrcpy
#31 /vendor/paragonie/hidden-string/src/HiddenString.php(56): ParagonIE\HiddenString\HiddenString::__construct
#30 /vendor/paragonie/halite/src/Symmetric/Crypto.php(208): ParagonIE\Halite\Symmetric\Crypto::decryptWithAd
#29 /vendor/paragonie/halite/src/Symmetric/Crypto.php(105): ParagonIE\Halite\Symmetric\Crypto::decrypt
#28 /vendor/philetaylor/doctrine-encrypt/Encryptors/HaliteEncryptor.php(82): Philetaylor\DoctrineEncryptBundle\Encryptors\HaliteEncryptor::decrypt
That doesn't make any sense. ?int
means int, but nullable
. This is probably a bug in PHP 8.
yes, I agree the error message is insane, Ive seen a few insane messages like this since testing PHP 8 that just make no sense.
Im happy to close this and leave it until PHP 8 becomes more stable. But its here as a record if others get the same issue but have more detail to help replicate it.
I could only ever replicate when using OPcache.preload in php.ini and not when preloading files after fpm loaded.