Bug #45401

Make Zend Framework 2 packages out-of-the-box compatible with TYPO3 Flow

Added by Martin Brüggemann almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Should have
Category:
Object
Target version:
-
Start date:
2013-02-12
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.4
Has patch:
No
Complexity:

Description

At the moment it's not possible to just use a composer dependency to get a ZF2 package running within Flow (Zend Mail f.e. https://packagist.org/packages/zendframework/zend-mail ). Flow seems to do some "reflecting magic" that results in some nice errors.

Maybe you can copy the packages, create a Package.php and set "$objectManagementEnabled = FALSE" but this is really dirty. There should be a comfortable way to integrate ZF2 packages via composer and just use it like in the followingn example (maybe be disabling object management functions for some Packages in Settings.yaml:

$mail = new \Zend\Mail\Storage\Mbox(array('filename' => 'catcontent.mbox'));

The well known Settings.yaml-option "TYPO3:Flow:object:excludeClasses:" unfortunately does not work here.

PHP Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found in /Users/bernd/Sites/Testproject/Packages/Libraries/zendframework/zend-mail/Zend/Mail/Protocol/SmtpPluginManager.php on line 21
Uncaught Exception
Execution of subprocess failed with exit code 255 and output:
Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found
in
/Users/bernd/Sites/Testproject/Packages/Libraries/zendframework/zend-mail/Zend/Mail/Protocol/SmtpPluginManager.php
on line 21
The erroneous command was:
FLOW_ROOTPATH='/Users/bernd/Sites/Testproject/' FLOW_CONTEXT='Development'
XDEBUG_CONFIG='idekey=FLOW_SUBREQUEST remote_port=9001'
"/opt/local/bin/php" -c '/opt/local/etc/php54/php.ini'
'/Users/bernd/Sites/Testproject/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/../../../../Scripts/flow.php'
'typo3.flow:core:compile'
More Information
Exception code #1355480641
File /Users/bernd/Sites/Testproject/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Booting/Scripts.php line 552
Exception reference #201302120924552d1193

#1

Updated by Bastian Waidelich almost 8 years ago

TYPO3:Flow:object:excludeClasses
should do the trick. But you probably have to set it before installing the incompatible package – otherwise the exception will be thrown before the setting has an effect.
#2

Updated by Bastian Waidelich over 7 years ago

  • Status changed from New to Accepted
  • Assignee set to Bastian Waidelich
#3

Updated by Bastian Waidelich over 7 years ago

  • Category changed from AOP to Object
  • Status changed from Accepted to Closed

Hi Martin,

If you take a close look to the exception message:

PHP Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found in Packages/Libraries/zendframework/zend-mail/Zend/Mail/Protocol/SmtpPluginManager.php on line 21 [...]

The actual issue is not related to some "reflecting magic" of Flow, but to the ZF Mail package not correctly defining their dependency. In this case The "SmtpPluginManager" relies on the "ServiceManager" package to be installed.
So in order to fix this, you simply need to install that one, too.

After that you might get some reflection related exception. In my case:

Fatal error: Cannot use ArrayObject as ArrayObject because the name is already in use in Packages/Libraries/zendframework/zend-stdlib/Zend/Stdlib/ArrayStack.php

This can be fixed as described above in the Settings.yaml of the distribution or of the package that requires the ZF packages:

TYPO3:
  Flow:

     # disable reflection for non psr-0 compliant 3rd party packages
    object:
      excludeClasses:
       'zendframework.zendservicemanager' : ['.*']
       'zendframework.zendstdlib' : ['.*']

This works for me. To be sure, you can add the other ZF packages, too ('zendframework.zendloader', 'zendframework.zendmime' & 'zendframework.zendmail').

HTH

Also available in: Atom PDF