Closed phpguru closed 7 years ago
Did you upgrade ProxyManager without re-generating your proxies?
I'm not 100% sure exactly what you mean. I tried several different versions, deleted vendor/ocramius/proxy-manager and did a composer install again, but it kept complaining.
it kept complaining.
in /var/www/production/releases/20170717122400/var/cache/prod/appProdProjectContainer.php
Re-dump your container after changing ProxyManager
version.
If you mean to php bin/console cache:clear
and composer dump-autoload
yes I've done that. The code gets rebuilt with ": bool" return type hinting that is incompatible with the doctrine class.
that is incompatible with the doctrine class.
Can you clarify?
Is this supposed to be closed?
Weird, no. It's been awhile since I did a cross-fork PR on Github.
When Symfony builds the appProdContainer, one of two files Symfony builds upon first run after cache clear, it creates this method...
public function initializeProxy()
{
return $this->initializer596d2cc00ac8c163190862 && $this->initializer596d2cc00ac8c163190862->__invoke($this->valueHolder596d2cc00ac84017495121, $this, 'initializeProxy', array(), $this->initializer596d2cc00ac8c163190862);
}
Your LazyLoading class contains this method signature:
public function intializeProxy() : bool
{
}
The " : bool" in your class is causing a fatal error, for my combination of Doctrine, PHP 7.1, ubuntu. I manually removed " : bool" from those two methods and the error went away.
Are you running all environments with the same locked dependencies?
On 19 Jul 2017 7:38 PM, "Geoffrey Hoffman" notifications@github.com wrote:
Weird, no. It's been awhile since I did a cross-fork PR on Github.
When Symfony builds the appProdContainer, one of two files Symfony builds upon first run after cache clear http://oro-quickies.alanstorm.com/symfonys-two-generated-php-files/index.html, it creates this method...
public function initializeProxy() { return $this->initializer596d2cc00ac8c163190862 && $this->initializer596d2cc00ac8c163190862->__invoke($this->valueHolder596d2cc00ac84017495121, $this, 'initializeProxy', array(), $this->initializer596d2cc00ac8c163190862); }
Your LazyLoading class contains this method signature:
public function intializeProxy() : bool { }
The " : bool" in your class is causing a fatal error, for my combination of Doctrine, PHP 7.1, ubuntu. I manually removed " : bool" from those two methods and the error went away.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Ocramius/ProxyManager/issues/378#issuecomment-316461884, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakDblCcFwEiFLmX89O3kJuhBstq2zks5sPj8EgaJpZM4Oaola .
I believe so... meaning composer.json & composer.lock is the same, and doing composer install
?
Ok weird, in my appDevDebugProjectContainer built on Mac dev environment, the method signature is
public function initializeProxy() : bool
{
}
So I'm not sure what's going on when I deploy the project in production on Ubuntu. It could also be a difference between coercive (in dev) and strict (in prod) type declarations. It's not clear.
The signature of the generated code should have the return type
On 19 Jul 2017 7:49 PM, "Geoffrey Hoffman" notifications@github.com wrote:
Ok weird, in my appDevDebugProjectContainer built on Mac dev environment, the method signature is
public function initializeProxy() : bool { }
So I'm not sure what's going on when I deploy the project in production on Ubuntu. It could also be a difference between coercive (in dev) and strict (in prod) type declarations. It's not clear.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Ocramius/ProxyManager/issues/378#issuecomment-316464887, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakBLX1PDW_9Po7pF8ZMGx4Z87mw77ks5sPkGqgaJpZM4Oaola .
Yeah, that much has become clear, and it's working fine on Mac with PHP 7.0.20. It's not clear why the appProdProjectContainer.php is not built correctly for me, but it's not an issue with ProxyManager. Thanks for your help.
@phpguru to clarify, the return type is generated here: https://github.com/Ocramius/ProxyManager/blob/5c8c273a171c58a432d990394f183d77685adb0b/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php#L47
This could be caused by an error in older Symfony versions. I don't know if it still exists.
Symfony should invoke PhpDumper to generate appProdProjectContainer.php. However, it checks if there is a cached version before and uses it instead of generating it. If the cached file was generated by an older version of ProxyManager, it doesn't contain the return type yet and therefore PHP crashes.
If debug is disabled, it doesn't even check if this cached version is up to date:
But I'm sure I also could re-produce this without the --no-debug
flag. This causes a more complex check if this cached file is "fresh" and I guess it didn't/doesn't work correctly as well.
Symfony should invoke PhpDumper to generate appProdProjectContainer.php. However, it checks if there is a cached version before and uses it instead of generating it. If the cached file was generated by an older version of ProxyManager, it doesn't contain the return type yet and therefore PHP crashes.
ProxyManager is designed to invalidate all pre-existing proxy classes at each differing version of the library:
I think symfony cache should consider a hash of installed.json
to determine if a cache should be slammed (probably already the case, but not sure)
Trying to deploy Symfony3 project on Ubuntu with PHP 7.1
I'm not sure what versions I am supposed to be using.
Here is my composer.json
When I remove ": bool" from the two methods in vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/LazyLoadingInterface.php it works fine.