TYPO3 : Extension upgrade from version 7 to 9 - upgrade

I just updated my TYPO3 site from 7.6.x to 9.5.x and I get error with a custom extension :
Error :
Call to a member function exec_SELECTquery() on null
I think my plugin is not compatible with TYPO3 9.5.x.
The error come from this line :
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy, $orderBy, $limit);
How to edit this line to make it works with TYPO3 9.

With TYPO3 9 the database interface $GLOBALS['TYPO3_DB'] has beeen removed and the usage of doctrine-dbal is mandantory.
you can get more information along with some examples in the chapter about migration in the manual.

Related

InvalidArgumentException in TYPO3 extension we_cookie_consent

I am getting an error in we_cookie_consent TYPO3 extension. This error occurs after I installed bw_focuspoint_images extension. I have installed both extensions via composer. My TYPO3 version is 10.4.21.
(1/1) #1411840171 InvalidArgumentException
The class "Websedit\WeCookieConsent\Resource\Rendering\YouTubeRenderer"
you are trying to register is not available
in /www/htdocs/w01c6c77/t3carthago.digitalfairydust.dev/t3carthago2021/public/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php line 60
at TYPO3ICMSICorelResourcelRendering RendererRegistry-›registerRendererClass(WebseditlIWeCookieConsentlIResourcellRendering|YouTubeRenderer')
in /wwwhtdocs/w01c6c77/t3carthago.digitalfairydust.dev/t3carthago2021/public/typo3conflext/we_cookie_consent/ext_localconf.php line 7
composer.json code:
"autoload": {
"psr-4": {
"Carthago\\CarthagoExt\\": "public/typo3conf/ext/carthago_ext/Classes/"
}
}
The issue is with these two lines in ext_localconf.php of the we_cookie_consent extension
$rendererRegistry->registerRendererClass(\Websedit\WeCookieConsent\Resource\Rendering\YouTubeRenderer::class);
$rendererRegistry->registerRendererClass(\Websedit\WeCookieConsent\Resource\Rendering\VimeoRenderer::class);

Class not found error on custom TYPO3 extension

I have a custom frontend extension that I have installed on TYPO3 10.
I took a snippet of code from another friend extension and I have some problem to declare the hook class:
under hooks I have a file PageLayoutView.php.
class PageLayoutView implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface {...
Then in the ext_localconf.php I have added this line:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$_EXTKEY] = \MyVendor\myTheme\Hooks\PageLayoutView::class;
in ext_tables.php file i have the following namespace:
call_user_func(
function()
{
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Myvendor.myExtname',
'Templates',
'Ext name'
);
In the backend I get this error:
(1/1) Error
Class 'MyVendor\myTheme\Hooks\PageLayoutView' not found
what i'm missing here ?
Did you try to dump the autoload information in the TYPO3 Install Tool?
If it's a composer based installation, try to remove the extension completely and require it again afterwards.
And you should check the namespace in PageLayoutView.php.

Symfony 5 Parse error: syntax error, unexpected '?' In C:\Users\public\index.php on line 15

I try to start a new project symfony 5 simple. When I start the server "symfony server: start", I have this answer:
Parse error: syntax error, unexpected '?' In C:\Users\Philippe\Documents\my_project_name\public\index.php on line 15.
I have windws 10, PHP 7.4.3, wamp server but its off.
I show you my terminal:
Answer is simple php5.6 does not support Null coalescing operator (??). This operator is available from PHP7+ (php.net)
Solution 1:
Upgrade your PHP version to ^7
Solution 2:
Change code
PHP 7+ $username = $loggedUser ?? 'nobody';
PHP 5.6 $username = isset($loggedUser) ? $loggedUser : 'nobody';
both is equivalent, return logged user if set, otherwise nobody.
It says in the output that you are running "PHP cgi v5.6.40". Run symfony local:php:list and see what is available to be able to be run. You need to install PHP 7.4 as php-fpm (if available on WAMP), or php-cgi. The Symfony Server can't use the cli version to run webpages.
symfony local:php:refresh may also help, or install other versions of PHP.
> symfony local:php:list
# You'll see all supported SAPIs (CGI, FastCGI, etc.) for each version.
# FastCGI (php-fpm) is used when possible; then CGI (which acts as a FastCGI
# server as well), and finally, the server falls back to plain CGI.
from: https://symfony.com/doc/current/setup/symfony_server.html#selecting-a-different-php-version

typo3 backend does not parse: syntax error, unexpected 'class' (T_CLASS)

I just installed Yet Another Gallery 4.0.7 on Typo3 6.2.19. When I try to open backend module I only get this error:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/clients/client6/web32/web/typo3conf/ext/pt_extlist/Classes/Domain/Configuration/Filters/FilterConfig.php on line 351
Screenshot:
The error is coming from the extension "List Generator". The code uses the Class::class syntax which is probably not supported by your version of PHP. Check if you are running PHP 5.5 or higher.
You should try to call class like: 'Vendor\YourController\Task\Yourclass', instead of \Vender\YourController\Task\YourClass::class

Class 'mPDF' not found in Yii2

I have problem with my page on server.
I'm using yii2 framework and mPDF;
All configured according to the instructions: http://www.bsourcecode.com/yiiframework2/create-pdf-files-using-mpdf-in-yiiframework-2-0/
Page work on localhost on Windows and Xampp
When I try run page on Debian 8 I have error:
Class 'mPDF' not found
Configuration: http://www.bsourcecode.com/yiiframework2/create-pdf-files-using-mpdf-in-yiiframework-2-0/
function in php:
public function actionCreatepdf()
{
$request = Yii::$app->request;
$generate_table = $request->post();
$mpdf = new mPDF;
$mpdf->WriteHTML($this->renderPartial('view_pdf', ['data'=>$data]));
$mpdf->Output('data.pdf', 'D');
exit;
}
I have no idea what I'm doing wrong, it's not running on Debian
I had this issue when migrating from Ubuntu (php 5.6) to CentOS 7 (PHP 7.1)
The easiest thing to do, without manually editing the composer file was to change the use/import in the controller:
//use mPDF; #Php 5.6
use Mpdf\Mpdf; #Php 7.0
Solved! As mentioned before it was due to capital cases.
I used following and it is now working on CENTOS 7 (probably similar on most Linux versions)
<?php
namespace app\controllers;
use Yii;
//use mPDF; Note this line is Commented out
use mpdf;
And then use it as follows:
public function actionIndex(){
$model = new Mpdf();
$model->SetHeader('header');
$model->WriteHTML("PDF contents");
$model->SetFooter('footer');
$model->Output('MyPDF.pdf', 'D');
exit;
}
In my case which i just resolved, adding
'mPDF\' => array($vendorDir . '/mpdf') to autoload_psr4.php required me to namespace most of the class files in ../mpdf/classes using the line
namespace mPDF;
Also among the errors i fixed was changing include to include_once to prevent php from seeing some classes as duplicate declaration despite the presence of class_exists() test