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
Error: Expected a value other than null. #1480
Comments
As for the file thats breaking, I have no clue. This is my first run with infection/infection so you'd have to help guide me to find the problem code. I can tell you its a CakePHP 4.2.2 application |
I'm seeing this as well on a fresh Symfony 5.2 + PHP 8 installation, running with PHPUnit 9.5, and PCOV. The stack trace is identical. I tried debugging a bit because I only have a few files. It fails in Entities and Repositories, although if I remove any getters and setters from the entity it works. In the repository, it only works if I remove the constructor. |
can I ask you to post the content of those files here? Are you able to reproduce it on our Playground? |
I tried reproducing it in the playground without success. Nonetheless here is an example of an entity that is causing it to break. I stripped it to the minimum that still breaks Infection: <?php
declare(strict_types=1);
namespace App\Infrastructure\Core\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Infrastructure\Core\Repository\UserRepository;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @ORM\Table(name="users")
*/
class User
{
/**
* @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private int $id;
public function getId(): int
{
return $this->id;
}
} There's nothing special about it so I'm thinking the problem must be elsewhere. However, weirdly if I remove the getter everything works. Another thing to note is that the only tests I have currently don't even test this class at all. |
Here's something else I found:
Based on this looks like an issue introduced by that PR. Actually, just reverting this one line fixes it: https://github.com/infection/infection/pull/1435/files#diff-87d093f6c6430c50b8ae34009e2fdbb447d50128df5e2d71aa12c4fd98b60b92R106 |
It's despicable it took me three weeks to get around at this issue. Should be fixed by #1494. If anyone wishes to give it a shot, please be our guest. |
@challgren @AlexandruGG released as https://github.com/infection/infection/releases/tag/0.21.3 Thank you @sanmai |
Ok cool thanks @sanmai I'll try it again once I get my project refactored so it will be a couple days before I can report back. |
@sanmai thank you very much for the speedy fix! I can confirm everything works now with the latest release 🎉 |
I can confirm this has now been fixed!!!!
|
I get this error too. I'm a brand new user and have infection/infection 0.21.0@dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82 PHPUnit version 8.5.14 PHP 7.4.15 Xdebug 3.0.2 codebase is CakePHP 4.2.2.
See details #1357 (comment)
Originally posted by @challgren in #1357 (comment)
The text was updated successfully, but these errors were encountered: