Zend\Form\FormElementManager not found #71
Comments
Can you provide the error message, please? |
Here it is:
|
Confirming break at 2.8.2/3 Exception:
Trace
|
I've tried to reproduce this by doing the following:
As the To take things further, I did the following:
This, in other words, was a thorough test to ensure that the polyfill must be invoked. I then fired up the server for each of PHP 5.5, 5.6, and 7.0. The code worked perfectly in all cases. So, I am unable to reproduce with the code that ZF ships. That means the problem is elsewhere. I have a few ideas:
|
I've tested whether or not this is a Composer autoloading issue by issuing each of: $ composer dump-autoload --optimize-autoloader
$ composer dump-autoload --classmap-authoritative The code continues to work under both scenarios. In looking through the Just for the record: composer shows the following are installed (partial list, only the relevant packages):
|
I'll try to pinpoint a test to reproduce the issue. I basically have a composer set at @stable, I'll try to find the culprit. The issue occurs in my code, whether or not the Lazy Factory is invoked. It's getting FormElementManager on the SM that triggers the failure. |
Just created a new test by having a controller that accepts return new TestController($container->get('FormElementManager')); Again, just works in each of PHP 5.5, 5.6, and 7.0. I also added the following into a template to see what it generates: Does FormElementManager exist? <b><?= class_exists(Zend\Form\FormElementManager::class) ? 'YES' : 'NO' ?></b> Each version prints Do you have a custom factory for |
I don't know why it worked when I changed the zend-form version back to 2.8.1 but as I see, another broken package info blocked the autoload info creation. I managed to fix the other issue and after these test results I tried to reproduce this error, but it vanished. So my bad, I apologize, I cannot reproduce this issue either. The PHP version may have not caused any effect, only it was another composer install. |
@adamturcsan This may be a subtle composer bug. If I can figure out a way to reproduce it, I'll report it upstream. Thanks for following up! |
Just wanted to add my 2 cents: |
@Estigy There is a way around that: add a /** @var Zend\Form\FormElementManager\FormElementManagerV3Polyfill */
$forms = $services->get(FormElementManager::class); If you have a better suggestion for handling the polyfill, I'd definitely welcome a pull request. This was the best solution I could find that worked consistently. |
Since zend-form v.2.8.2 I got this fatal error when initializing ZF2 app with PHP 5.6.4. I guess class aliasing during the autoload process doesn't work properly.
It works with PHP 7.0.4.
The text was updated successfully, but these errors were encountered: