andersundsehr / aus_driver_amazon_s3

Provides a TYPO3 FAL driver for the Amazon Web Service S3
GNU Lesser General Public License v3.0
20 stars 39 forks source link

update to 1.7.1 #35

Closed dni closed 4 years ago

dni commented 6 years ago

today i updated to the version 1.7.1 and now i get this error. any ideas?

Fatal error: Cannot redeclare GuzzleHttp\json_encode() (previously declared in /srv/typo3_src-8.7.13/vendor/guzzlehttp/guzzle/src/functions.php:322) in /var/www/dummy/typo3conf/ext/aus_driver_amazon_s3/Resources/Private/PHP/Aws/GuzzleHttp/functions.php on line 323

dni commented 6 years ago

i removed all GuzzleHttp stuff from /Resources/Private/PHP/Aws/aws-autoloader.php and now it is working.

looks like guzzle is now loaded in the typo3_src??

BastianBalthasarBux commented 6 years ago

Did exactly what you suggested on a TYPO3 v 8.7.12 -> now back in working operation. Thanks @dni

BastianBalthasarBux commented 6 years ago

I need to mention: it is not good style, publishing security updates silently, without notifying TYPO3 security team in advance ...

cehret commented 5 years ago

As versions below 1.7.1 are marked as a security issue now (https://typo3.org/security/advisory/typo3-ext-sa-2018-003/) it would be great to fix the extension for TYPO3 8.7, too. For TYPO3 7.6 aus_driver_amazon_s3 V 1.7.1 is working. on TYPO3 8.7 GuzzleHttp is included in TYPO3 8 so an error is raised.

I could fix this, so it is still working on 8.7 AND 7.6 with changing the following lines in /Resources/Private/PHP/Aws/aws-autoloader.php:

require __DIR__ . '/Aws/functions.php'; require __DIR__ . '/GuzzleHttp/functions.php'; require __DIR__ . '/GuzzleHttp/Psr7/functions.php'; require __DIR__ . '/GuzzleHttp/Promise/functions.php'; require __DIR__ . '/JmesPath/JmesPath.php';

to

require __DIR__ . '/Aws/functions.php'; if (! function_exists('GuzzleHttp\json_encode')) { require __DIR__ . '/GuzzleHttp/functions.php'; require __DIR__ . '/GuzzleHttp/Psr7/functions.php'; require __DIR__ . '/GuzzleHttp/Promise/functions.php'; } require __DIR__ . '/JmesPath/JmesPath.php';

The point is to check if GuzzleHttp\json_encode still exists before including the funtions.php's!

Lagerregal commented 5 years ago

Does this error occurs on a composer based setup? Please use composer to install this extension (highly recommended).

cehret commented 5 years ago

Not composer based!

Lagerregal commented 5 years ago

If two applications (TYPO3 & AWS SDK) require the same dependency you got "Fatal error: Cannot redeclare". Solving this without composer is really unpleasant... (the "aws-autoloader.php" file is maintained by AWS).

My warm personal recommendation to you: Switch your TYPO3 setup to Composer mode. Composer is for PHP applications the state of the art - especially for professional use cases. TYPO3 and AWS S3 are no One-Click-Wordpress products. Because of this reasons the non-composer mode is not well maintained by this extension.

BastianBalthasarBux commented 5 years ago

I cite mattes: "the use of composer is not mandatory" ... lately on slack. And while composer mode for this one project I need that aws thing right now would be ok, it is impossible to use for my general projects. For good reason. But thanks for the information anyways.