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

PHP Warning: Cannot declare class PHPCoord\Point, because the name is already in use #68

Closed
DavidBennettUK opened this issue Sep 23, 2024 · 3 comments · Fixed by #69
Closed

Comments

@DavidBennettUK
Copy link
Contributor

We're seeing the below warnings in our logs on every request. It seems like the aliases defined in bc_namespace.php may be being declared twice. Any ideas why this might be? This only seems to be happening in production, we don't get these in development - so hard to provide a reproducer.

This is on PHP 8.3 with a standard Composer setup with Symfony 6.4.

NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\Point, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 13
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\BritishNationalGridPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 14
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\CompoundPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 15
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\GeocentricPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 16
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\GeographicPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 17
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\IrishGridPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 18
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\IrishTransverseMercatorPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 19
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\ProjectedPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 20
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\UTMPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 21
NOTICE: PHP message: PHP Warning: Cannot declare class PHPCoord\VerticalPoint, because the name is already in use in vendor/php-coord/php-coord/src/bc_namespace.php on line 22
@dvdoug
Copy link
Owner

dvdoug commented Sep 23, 2024

That's...really weird. And it's complaining about the aliases, not the actual class names 🤔

Do you have any PHPCoord related config inside Symfony? e.g. maybe service autowiring is getting confused?

@DavidBennettUK
Copy link
Contributor Author

I've finally got to the bottom of it. It was only happening in production as it's caused by having OPCache preloading enabled. I found another project having a similar issue and have applied the same fix in a PR here: #69

@dvdoug
Copy link
Owner

dvdoug commented Sep 24, 2024

Ah nice

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