Skip to content

Segmentation fault in dataprovider with PersistentProxyObjectFactory #971

@VincentLanglet

Description

@VincentLanglet

Hi @nikophil, I saw you made #648 and I think I have an edge case.

I'm using foundry and phpunit, I have added the extension

<bootstrap class="Zenstruck\Foundry\PHPUnit\FoundryExtension" />

When using

DeploymentFactory::createOne()->getName();

in a Dataprovider of a TestCase (I didn't try a WebTestCase, my use case is a unit test ATM) I'm getting a segmentation fault.

This occurs with the following factory

final class DeploymentFactory extends PersistentProxyObjectFactory
{
    public static function class(): string
    {
        return Deployment::class;
    }

    /**
     * @return array<string, mixed>
     */
    protected function defaults(): array
    {
        $countryCode = self::faker()->countryCode();

        return [
            'id' => $countryCode,
            'name' => self::faker()->word(),
            'engineDomain' => 'api.'.$countryCode.'.weglot.com',
            'frontDomain' => 'app.'.$countryCode.'.weglot.com',
        ];
    }
}

As soon as I change the PersistentProxyObjectFactory into a PersistentObjectFactory the issue is solved.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions