Typo3 Fatal error: Error\Exception: PHP Warning: gzuncompress() - docker

I have updated my Typo3 ddev installation and i get this error:
Fatal error: Uncaught TYPO3\CMS\Core\Error\Exception: PHP Warning: gzuncompress(): data error in /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php line 158 in /var/www/html/public/typo3/sysext/core/Classes/Error/ErrorHandler.php:130 Stack trace: #0 [internal function]: TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'gzuncompress():...', '/var/www/html/p...', 158, Array) #1 /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php(158): gzuncompress('a:1:{i:0;a:25:{...') #2 /var/www/html/public/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php(81): TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend->get('1__0_-99') #3 /var/www/html/public/typo3/sysext/core/Classes/Utility/RootlineUtility.php(211): TYPO3\CMS\Core\Cache\Frontend\VariableFrontend->get('1__0_-99') #4 /var/www/html/public/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php(68): TYPO3\CMS\Core\Utility\RootlineUtility->get() #5 /var/www/html/public/typo3/sysext/ex in /var/www/html/public/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 130
I don't understand what i'm missing.
I have did composer update, didn't solve it.
Even installtool say "no site configuration" "page are inaccessible"
Typo3 10.4
PHP 7

This may happen if you have utf8mb4 configured in TYPO3 configuration for the database but it is an old database with utf8 encoding.
Solution:
Dump the database
Drop the database
Create the database
Import the dump
You may want to check the dump that it does not force old utf8 encoding.

I've had a similar problem and truncating all cache tables on the database solved it for me.

I have find the solution, i was had a bad cache configuration in the localconf file, so i deleted all backend cache configuration:
[
'cacheConfigurations' => [
'hash' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
],
'imagesizes' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'pages' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'pagesection' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'rootline' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
],
],
So i guess that the caching method that i was using it wasn't working... maybe from my server side, i hope i find a solution for caching.

Related

getting wrong user with laravel sanctum

I am using Laravel Sanctum to provide a personal access token to my clients.
I am using these guards in auth.php:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'client' => [
'driver' => 'token',
'provider' => 'clients',
'hash' => false
]
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'clients' => [
'driver' => 'eloquent',
'model' => App\Models\Client::class,
],
],
I give my clients tokens using the following code:
$client = Client::find($id);
$token = $client->createToken('CLIENT_TOKEN');
but whenever I try to access the user with $request->user() I get the wrong user. while the token is completely different from what the retrieved user is.
I am using laravel-swoole package as my webserver.

TYPO3: How can I set the sys_language_uid of news to -1 in TYPO3 9?

I want to use some news across multiple languages, but currently I can't choose -1 (all languages) via TYPO3 backend. Furthermore I can only choose between sys_language_uid 0 to 3, which are the uids of my configured languages.
If I take a look at the TCA configuration of the news model (tx_news_domain_model_news.php). Then I can see that -1, all languages still exists there.
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
],
],
'default' => 0,
]
],
but it is not not available for me:
Do I miss a specific language setting to enable this option or how I can enable this?
The issue was caused by another extension which have removed this -1 entry.

How to send messages using AWS Pinpoint service using PHP SDK

Hi I am trying to send a message using AWS Pinpoint with the PHP SDK, but I am getting an error. Any ideas why? Here is my code:
$client = new PinpointClient([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => 'MYIAMAWSKEY',
'secret' => 'MYAWSSECRET',
]
]);
$result = $client->sendMessages([
'ApplicationId' => 'MyAppId',
'MessageRequest' => [
'Addresses' => [
'AnIOSDeviceToken' => [
'BodyOverride' => 'aaa',
'ChannelType' => 'APNS',
'RawContent' => 'bbb',
'Context' => ['ccc' => '222'],
'TitleOverride' => 'ddd',
],
],
],
'MessageConfiguration' => [
'APNSMessage' => [
'Action' => 'OPEN_APP',
'Body' => 'Hello',
'RawContent' => 'World',
'SilentPush' => false,
'Title' => 'Hello World!!!',
],
],
]);
I get the following error:
DeliveryStatus: 'PERMANENT_FAILURE'
StatusCode: 400
StatusMessage: Invalid notification: Notification is malformed
According to the API Docs, 'MessageConfiguration' needs to be inside the 'MessageRequest' field. Please make sure your input parameters fully match the documented API Parameter Syntax.

ZF2 - Asset Manager, slowing down application

I started writing this as I was struggling to get ZF2 Asset Manager to work properly however in mid swing I managed to sort out the problem and felt the question still needs to be asked in order to help others.
If you are looking for an Asset Manager for ZF2, try out: https://github.com/RWOverdijk/AssetManager
The problems I faced was essentially due to a lack of documentation and the solution was really simple.
For asset manager to work, you essentially need to generate a cache of your files that your app can locate. Once the files have been located and are reachable, your app will speed up tremendously. The first problem I faced was the module.config.php file. The documentation is not clear in how to set this up correctly.
My original file looked like this:
'asset_manager' => [
'resolver_configs' => [
'paths' => [
__DIR__ . '/../assets',
]
],
],
Which essentially tells my application to look in the module/assets directory for any assets. This worked out the box but was VEERY slow...
I read up about caching and my modification of my file was as follows:
'asset_manager' => [
'caching' => [
'default' => [
'cache' => 'FilePath', // Apc, FilePath, FileSystem etc.
],
],
'resolver_configs' => [
'paths' => [
__DIR__ . '/../assets',
]
],
],
This did nothing... so after searching code in gitHub to see how others had implemented Asset Manager I discovered you can set the options of where to put the cache... so my new config became this:
'asset_manager' => [
'caching' => [
'default' => [
'cache' => 'FilePath', // Apc, FilePath, FileSystem etc.
'options' => [
'dir' => getcwd() . 'public',
]
],
],
'resolver_configs' => [
'paths' => [
__DIR__ . '/../assets',
]
],
],
Still my app was not working although the assets where being generated in a folder called: trunkpublic in the root of my app. After much frustration I realised that I need to update:
'dir' => getcwd() . 'public', to 'dir' => getcwd() . '/public',
Adding a slash put the folder in the public directory, which in retrospect is obvious since the app needs access to the cached files.
My final configuration is this:
'asset_manager' => [
'caching' => [
'default' => [
'cache' => 'FilePath', // Apc, FilePath, FileSystem etc.
'options' => [
'dir' => getcwd() . '/public',
//'dir' => getcwd() . '/data/cache/assets',
]
],
],
'resolver_configs' => [
'paths' => [
__DIR__ . '/../assets',
]
],
],
You will notice I have this snippet commented out:
//'dir' => getcwd() . '/data/cache/assets',
The above is super fast and is used with the Filepath option and is great for development mode, it essentially generates a hash of the file in the /data.cache/assets directory however for a production environment I prefer to have actual files saved to the assets cache found in: public/assets as this allows the app to grab the files directly without having to invoke php.
NOTE:
There was another issue I faced and this is due to misleading documentation
If you look at this line:
'cache' => 'Filesystem', // Apc, FilePath, FileSystem etc.
You may be tempted to add your files using CamelCase... however some may reauire CamelCase and others may require Normalcase... check the code for this...
works for me!!
'asset_manager' => array(
'caching' => array (
'default' => array(
'cache' => 'FilePath', // Apc, FilePath, FileSystem etc.
'options' => array(
'dir' => './public',
),
),
),
'resolver_configs' => array(
'paths' => array(
'MyModule' => __DIR__ . '/../public',
),
),
),
now i try fix flter JSMin and JSSqueeze
tank you!

Unable to override route via DI

I'm attempting to override the routes provided by ZfcUser using akrabat's method, however it doesn't seem to have any effect. I'm starting by rebasing the routes from /user to /users but will want to add other routes later on (should be simple if I can get this working).
My DI configuration:
return [
'di' => [
'instance' => [
'Zend\Mvc\Router\RouteStack' => [
'parameters' => [
'routes' => [
'zfcuser' => [
'options' => [
'route' => '/users'
]
]
]
]
]
]
]
];
Am I making an obvious mistake or has the configuration structure for this changed since this blogpost?
You'd overwrite configuration from within your own modules.
'router' => array(
'routes' => array(
'zfcuser' => array(
//...
)
)
)
Though if i'm correct the full DI Path should still work... It's important, too, that your module loads AFTER the zfcUser-Module. So within your application.config.php be sure that your modules Namespace is listed after zfcUser. Since the arrays simply get overwritten depending on load time ^^

Resources