Upgrade from TYPO3 9 to 10 - Fatal Error in Upgrade Wizard with no extensions enabled - typo3

I just upgraded my TYPO3 v9 to v10.04.27 and now i get an error in the Upgrade Wizard
(1/1) Error
Class 'TYPO3\CMS\Core\Cache\Frontend\StringFrontend' not found in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Cache/CacheManager.php line 351
As you can see in the path i also tried already with an older TYPO3 10 Version.
I disabled all extensions before the upgrade. Except the ones that cant be disabled.
So this should be a completely clean TYPO3 10 install (except the Config Files).
I dont know what i can do about this.
Here is the Full Trace:
Something went wrong. Please use Check for broken extensions to see if a loaded extension breaks this part of the install tool and unload it.
The box below may additionally reveal further details on what went wrong depending on your debug settings. It may help to temporarily switch to debug mode using Settings > Configuration Presets > Debug settings.
If this error happens at an early state and no full exception back trace is shown, it may also help to manually increase debugging output in typo3conf/LocalConfiguration.php:['BE']['debug'] => true, ['SYS']['devIPmask'] => '*', ['SYS']['displayErrors'] => 1,['SYS']['exceptionalErrors'] => 12290
Ajax error
Whoops, looks like something went wrong.
(1/1) Error
Class 'TYPO3\CMS\Core\Cache\Frontend\StringFrontend' not found
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Cache/CacheManager.php line 351
$backendInstance->initializeObject();
}
// New used on purpose, see comment above
$frontendInstance = new $frontend($identifier, $backendInstance);
if (!$frontendInstance instanceof FrontendInterface) {
throw new InvalidCacheException('"' . $frontend . '" is not a valid cache frontend object.', 1464550984);
}
if (is_callable([$frontendInstance, 'initializeObject'])) {
at TYPO3\CMS\Core\Cache\CacheManager->createCache()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Cache/CacheManager.php line 157
if ($this->hasCache($identifier) === false) {
throw new NoSuchCacheException('A cache with identifier "' . $identifier . '" does not exist.', 1203699034);
}
if (!isset($this->caches[$identifier])) {
$this->createCache($identifier);
}
return $this->caches[$identifier];
}
at TYPO3\CMS\Core\Cache\CacheManager->getCache()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Cache/DatabaseSchemaService.php line 51
$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
$tableDefinitions = '';
foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $cacheName => $_) {
$backend = $cacheManager->getCache($cacheName)->getBackend();
if (method_exists($backend, 'getTableDefinitions')) {
$tableDefinitions .= LF . $backend->getTableDefinitions();
}
}
at TYPO3\CMS\Core\Cache\DatabaseSchemaService->getCachingFrameworkRequiredDatabaseSchema()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Cache/DatabaseSchemaService.php line 33
* #param AlterTableDefinitionStatementsEvent $event
*/
public function addCachingFrameworkDatabaseSchema(AlterTableDefinitionStatementsEvent $event): void
{
$event->addSqlData($this->getCachingFrameworkRequiredDatabaseSchema());
}
/**
* Get schema SQL of required cache framework tables.
at TYPO3\CMS\Core\Cache\DatabaseSchemaService->addCachingFrameworkDatabaseSchema()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/EventDispatcher/EventDispatcher.php line 51
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
return $event;
}
foreach ($this->listenerProvider->getListenersForEvent($event) as $listener) {
$listener($event);
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
break;
}
}
at TYPO3\CMS\Core\EventDispatcher\EventDispatcher->dispatch()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Database/Schema/SqlReader.php line 75
}
}
/** #var AlterTableDefinitionStatementsEvent $event */
$event = $this->eventDispatcher->dispatch(new AlterTableDefinitionStatementsEvent($sqlString));
$sqlString = $event->getSqlData();
return implode(LF . LF, $sqlString);
}
at TYPO3\CMS\Core\Database\Schema\SqlReader->getTablesDefinitionString()
in /srv/typo3_src-10.4.20/typo3/sysext/install/Classes/Service/UpgradeWizardsService.php line 156
*/
public function getBlockingDatabaseAdds(): array
{
$sqlReader = GeneralUtility::makeInstance(SqlReader::class);
$databaseDefinitions = $sqlReader->getCreateTableStatementArray($sqlReader->getTablesDefinitionString());
$schemaMigrator = GeneralUtility::makeInstance(SchemaMigrator::class);
$databaseDifferences = $schemaMigrator->getSchemaDiffs($databaseDefinitions);
at TYPO3\CMS\Install\Service\UpgradeWizardsService->getBlockingDatabaseAdds()
in /srv/typo3_src-10.4.20/typo3/sysext/install/Classes/Controller/UpgradeController.php line 1042
$this->lateBootService->loadExtLocalconfDatabaseAndExtTables(false);
$adds = [];
$needsUpdate = false;
try {
$adds = $this->upgradeWizardsService->getBlockingDatabaseAdds();
$this->lateBootService->resetGlobalContainer();
if (!empty($adds)) {
$needsUpdate = true;
}
at TYPO3\CMS\Install\Controller\UpgradeController->upgradeWizardsBlockingDatabaseAddsAction()
in /srv/typo3_src-10.4.20/typo3/sysext/install/Classes/Middleware/Maintenance.php line 246
'Unknown action method ' . $action . ' in controller ' . $controllerName,
1505216027
);
}
$response = $controller->$action($request);
}
return $response;
}
at TYPO3\CMS\Install\Middleware\Maintenance->process()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 121
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->middleware->process($request, $this->next);
}
};
}
at class#anonymous/srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php:103$bc->handle()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php line 45
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request));
return $handler->handle($request);
}
}
at TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute->process()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172
if (!$middleware instanceof MiddlewareInterface) {
throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
}
return $middleware->process($request, $this->next);
}
};
}
}
at class#anonymous/srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php:138$bd->handle()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 78
* #return ResponseInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->tip->handle($request);
}
/**
* Seed the middleware stack with the inner request handler
at TYPO3\CMS\Core\Http\MiddlewareDispatcher->handle()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/AbstractApplication.php line 85
* #return ResponseInterface
*/
protected function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->requestHandler->handle($request);
}
/**
* Set up the application and shut it down afterwards
at TYPO3\CMS\Core\Http\AbstractApplication->handle()
in /srv/typo3_src-10.4.20/typo3/sysext/install/Classes/Http/Application.php line 52
protected function handle(ServerRequestInterface $request): ResponseInterface
{
$this->initializeContext();
$request = $request->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
return parent::handle($request)
->withHeader('X-Frame-Options', 'SAMEORIGIN');
}
/**
at TYPO3\CMS\Install\Http\Application->handle()
in /srv/typo3_src-10.4.20/typo3/sysext/core/Classes/Http/AbstractApplication.php line 97
final public function run(callable $execute = null)
{
try {
$response = $this->handle(
ServerRequestFactory::fromGlobals()
);
if ($execute !== null) {
call_user_func($execute);
}
at TYPO3\CMS\Core\Http\AbstractApplication->run()
in /srv/typo3_src-10.4.20/typo3/install.php line 105
call_user_func(function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
});
at {closure}()
in /srv/typo3_src-10.4.20/typo3/install.php line 106
call_user_func(function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
});
Any ideas?
Thank you in advance

Delete all extensions except the ones from TYPO3 core. Then cache will be rebuild without not needed classes.
I had some errors in my installations if extension are only deactivated but not deleted.

My guess is that you're using the StringFrontend somewhere, which was deprecated in TYPO3 9.2.
Can you check your LocalConfiguration.php and AdditionalConfiguration.php if you find "StringFrontend" anywhere and replace it with VariableFrontend or remove it completely? (as suggested in the migration path)

Related

Magento 2.4 Sidebar\RemoveItem - afterExecute() must be an instance of Magento\Framework\App\Response\Http

I have a plugin in my module that was working in Magento 2.3, but after upgrade to 2.4 i am getting the error
TypeError: Argument 2 passed to
..\Plugin\Controller\Checkout\Sidebar\RemoveItemPlugin::afterExecute()
must be an instance of Magento\Framework\App\Response\Http, instance
of Magento\Framework\Controller\Result\Json\Interceptor given
This is the code :
use Magento\Customer\CustomerData\SectionPoolInterface;
use Magento\Framework\Serialize\Serializer\Json;
class RemoveItemPlugin
{
public function __construct(
SectionPoolInterface $sectionPool,
Json $json
) {
$this->sectionPool = $sectionPool;
$this->json = $json;
}
public function afterExecute(
\Magento\Checkout\Controller\Sidebar\RemoveItem $subject,
\Magento\Framework\App\Response\Http $result
): \Magento\Framework\App\Response\Http {
/* Get Cart Items */
$sectionNames = "cart";
$sectionNames = $sectionNames ? array_unique(\explode(',', $sectionNames)) : null;
$forceNewSectionTimestamp = false;
$response = $this->sectionPool->getSectionsData($sectionNames, (bool)$forceNewSectionTimestamp);
/* Prepare Result */
$content = $this->json->unserialize($result->getContent());
$content['cartSection'] = $response;
$content = $this->json->serialize($content);
$result->setContent($content);
return $result;
}
}
I tried the answer in this question :
https://magento.stackexchange.com/questions/351344/magento-2-4-sidebar-removeitem-afterexecute-must-be-an-instance-of-magento-f
but once I change $result to be type resultInterface, I can no longer use $result->getContent() to return the cart json. Is there a way to do this with resultInterface?

Symfony createView causes error

I am using Symfony 3.3.10
I have the following code
/**
* #Route("/meta/edit/{metaId}", name="edit_price_meta_data")
*/
public function editMetaAction(Request $request,ItemPriceMeta $metaId)
{
$metaDataForm = $this->createForm("ItemBundle\Form\ItemPriceMetaType");
$data = [
'metaData'=>$metaId,
'metaDataForm'=>$metaDataForm->createView(),
];
return $this->render("#Item/Prices/Manage/editMetaData.html.twig",$data);
}
It produces the following error.
Error: Maximum execution time of 60 seconds exceeded
in vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php (line 2513)
public function createEntity($className, array $data, &$hints = array()){
$class = $this->em->getClassMetadata($className);
//$isReadOnly = isset($hints[Query::HINT_READ_ONLY])
$id = $this->identifierFlattener->flattenIdentifier($class, $data);
$idHash = implode(' ', $id);
if (isset($this->identityMap[$class->rootEntityName][$idHash])) {
$entity = $this->identityMap[$class->rootEntityName][$idHash];
$oid = spl_object_hash($entity);
The actual line highlighted as causing the error is $id = $this->identifierFlattener->flattenIdentifier($class, $data);
Removing 'metaDataForm'=>$metaDataForm->createView(), from my array, removes the error, so it seems to be the rendering of the form that is causing the error.
Increase PHP memory usage in php.ini

How to detect wrong URL using Joomla! System Plugin?

I have developed a Joomla! system plugin.
I would like to detect wrong URL when that plugin is executed.
For example:
If I enter a URL "http://localhost/wrong-url", I want to catch that error in the system plugin.
How do I know that the system will display the error page (404)?
You can do this using the following technique
Check URL Function
function checkURL($URL){
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpcode != 200) {
return false;
}else{
return true;
}
}
Use Of the CheckURL Function
/*URL May be a Joomla OR Non Joomla Site*/
if(checkURL("http://adidac.github.com/jmm/index.html")){
echo "URL Exist";
}else{
echo "URL NOT Exist";
//JError::raiseWarning(500,$URL. " is not exists");
}
if(checkURL("http://adidac.github.com/jmm/indexsdadssdasaasdaas.html")){
echo "URL Exist";
}else{
echo "URL NOT Exist";
//JError::raiseWarning(500,$URL. " is not exists");
}
NOTE: Check you have PHP curl lib installed
In a system plugin to trap the 404 you would have to add a function from your plugin as a callback to JError error handler array.
I would have a look at the way com_redirect does it, with it's system plugin. e.g.
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Set the error handler for E_ERROR to be the class handleError method.
JError::setErrorHandling(E_ERROR, 'callback', array('plgSystemRedirect', 'handleError'));
}
static function handleError(&$error)
{
// Get the application object.
$app = JFactory::getApplication();
// Make sure we are not in the administrator and it's a 404.
if (!$app->isAdmin() and ($error->getCode() == 404))
{
// Do cool stuff here
}
}
The only problem is JError is depreciated so I'm not sure going forward when this would break e.g. it should be fine in 3.0, 3.1, 3.2 and 3.5 but after that who knows?
I know this is an old question, but I needed a solution today and found this question, so leaving my solution below to help anyone else searching in the future.
In the plugin file:
/**
* The global exception handler registered before the plugin was instantiated
*
* #var callable
* #since 3.6
*/
private static $previousExceptionHandler;
/**
* Constructor.
*
* #param object &$subject The object to observe
* #param array $config An optional associative array of configuration settings.
*
* #since 1.6
*/
public function __construct(&$subject, $config) {
parent::__construct($subject, $config);
// Register the previously defined exception handler so we can forward errors to it
self::$previousExceptionHandler = set_exception_handler(array('PlgSystemVmsreporting', 'handleException'));
}
public static function handleException($exception) {
// Wrap in try/catch to prevent any further exceptions being raised
try {
// Do whatever you need with the error
} catch (Exception $e) {
//Don't make a fuss - fail silently
}
// Proxy to the previous exception handler if available, otherwise use the default Joomla handler
if (self::$previousExceptionHandler) {
call_user_func_array(self::$previousExceptionHandler, array($exception));
} else {
ExceptionHandler::render($exception);
}
}

$this->fetchRow creates failure in phpunit in Zend framework

I followed Rob Allens ZF 1 Tutorial and wanted to pimp it up with some UnitTesting. But whenever I run the phpunit command, i get the message:
here was 1 failure:
1) IndexControllerTest::testDeleteAction
Failed asserting last controller used <"error"> was "Index"
/path/to/library/Zend/Test/PHPUnit/ControllerTestCase.php:1000
/path/to/tests/application/controllers/IndexControllerTest.php:55
FAILURES!
Tests: 4, Assertions: 9, Failures: 1.
The Action in question is the deleteAction and looks like this:
public function deleteAction() {
if ($this->getRequest()->isPost()) {
$del = $this->getRequest()->getPost('del');
if ($del == 'Yes') {
$id = $this->getRequest()->getPost('id');
$wishes = new Application_Model_DbTable_Wishes();
$wishes->deleteWish($id);
}
$this->_helper->redirector('index');
}
else {
$id = $this->_getParam('id', 0);
$wishes = new Application_Model_DbTable_Wishes();
$this->view->wish = $wishes->getWish($id);
}
}
I tracked the error down to be $wishes>getWish($id); so if i go to that function, that looks like this:
public function getWish($id) {
$id = (int) $id;
$row = $this->fetchRow('id = ' . $id);
if(!$row){
throw new Exception("Could not find row $id");
}
return $row->toArray();
}
it appears the line $row = $this->fetchRow('id = ' . $id); causes the problem. And I can't figure out why. All action work just fine, they do as expected.Any idea how to fix this?
Thanks!
Maybe try using the select() object instead if a plain string:
public function getWish($id) {
$id = (int) $id;
$select = $this->select();
$select->where('id = ?', $id);
$row = $this->fetchRow($select);
if(!$row){
throw new Exception("Could not find row $id");
}
return $row->toArray();
}
This just a wild guess, but who knows. The only thing that looks at all odd is the lack of a placeholder in the query string (?).
FetchRow() does like to work with the select() object, in fact if you pass a string the first thing fetchRow() does is build a select(). So maybe it just doesn't like the string.

Zend Soap Server with wsdl autodiscovery doesn't work as expected

Duplicate of this question
I'm trying to create a web service with Zend_Soap_Server in wsdl autodiscovery mode, but I obtain very strange effects... here the code:
server:
<?php
require_once('Zend/Soap/AutoDiscover.php');
require_once('Zend/Soap/Server.php');
require_once('Zend/Soap/Wsdl.php');
require_once('library/SoapActions.php');
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapActions');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://localhost:8083/server.php?wsdl');
$server->setClass('SoapActions');
$server->setEncoding('ISO-8859-1');
$server->handle();
}
SoapActions class:
class SoapActions {
/**
* Test function
*
* #param String $a
* #param String $b
* #return String
*/
public function test1($a, $b) {
return "you passed me ".$a." ".$b;
}
/**
* Test function 2
*
* #param String $a
* #param String $b
* #return String
*/
public function test2($a, $b) {
return "you passed me ".$a." ".$b;
}
}
I tried to use the function test1 and test2 using the Zend_Soap_Client class, here the code:
require_once('Zend/Soap/Client.php');
$client = new Zend_Soap_Client("http://localhost:8083/server.php?wsdl");
try {
echo $client->test2("foo","bar"); //this works!
} catch (Exception $e) {
echo $e;
}
try {
echo $client->test1("foo","bar"); //this doesn't work!
} catch (Exception $e) {
echo $e;
}
I cannot understand because the test2 function works as expected, the test1 function return the following exception:
SoapFault exception: [Sender] Function
("test1") is not a valid method for
this service in
/usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php:1121
Stack trace:
0 /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php(1121):
SoapClient->__soapCall('test1', Array,
NULL, NULL, Array)
1 /usr/local/zend/apache2/htdocs/webservice/client.php(6):
Zend_Soap_Client->__call('test1',
Array)
2 /usr/local/zend/apache2/htdocs/webservice/client.php(6):
Zend_Soap_Client->test1('foo', 'bar')
3 {main}
I tried to invert the functions name... the result is incredible, works only test2! I'm getting crazy, it seems that somewhere on server side it save the function name...
Can someone help me?
SOLVED! The problem was this setting in the php.ini file:
soap.wsdl_cache_enabled=1
I set this to 0 and now it works fine!
If you don't want change your php.ini:
// WSDL_CACHE_NONE; /* 0 Pas de cache */
// WSDL_CACHE_DISK; /* 1 Sur le disque supprimer le fichier pour le réinitialiser */
// WSDL_CACHE_MEMORY; /* 2 En mémoire => redémarrer Apache pour le réinitialiser */
// WSDL_CACHE_BOTH; /* 3 En mémoire et sur le disque */
$options = array();
$options['cache_wsdl'] = WSDL_CACHE_NONE;
$client = new Zend_Soap_Client("http://localhost:8083/server.php?wsdl", $options);