TYPO3 throws Error after Updating to 11.5.16 and PHP 8.1 (get_class_methods(): Argument #1 - typo3

After Updating from TYPO3 9.5.x LTS and PHP 7.4 to TYPO3 11.5.16 and PHP 8.1 I am getting this error:
get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
I know it's about my Extension (when I disable it the Error disappears), but the further debug Information I are not helping me:
in /html/typo3/typo3_src-11.5.16/typo3/sysext/extbase/Classes/Mvc/ExtbaseRequestParameters.php line 302
// todo: this is nonsense! We can detect a non existing method in
// todo: \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin, if necessary.
// todo: At this point, we want to have a getter for a fixed value.
$actionMethodName = $this->controllerActionName . 'Action';
$classMethods = get_class_methods($controllerObjectName);
if (is_array($classMethods)) {
foreach ($classMethods as $existingMethodName) {
if (strtolower($existingMethodName) === strtolower($actionMethodName)) {
$this->controllerActionName = substr($existingMethodName, 0, -6);
I couldn't find anything searching github, stackoverflow or the web. Anyone else had the same problem or knows where this could come from?

Right after this Post, it came to my Mind to change the PHP Version back to 7.4. With PHP 7.4 I've got a different Error Message ("Class does not exist. Reflection failed.") which leads me to:
https://forge.typo3.org/issues/91239
I made the Mistake to Register Plugin With VendorName. Just in case anyone else does it the same way, I've written this answer and would like to keep this Post.

Related

Moodle - update_moduleinfo - invalid course module id

I'm currently building a new moodle plugin. I'm using add_moduleinfo and update_moduleinfo. To add a new attandance atictivity in a course and update it later on.
Sadly I'm facing the issue that update_moduleinfo always throws an "invalid course module id" error. I already checked the cm entry in my database to ensure im using the right module instance.
I dont really know what to do.
$cm = get_coursemodule_from_instance($moduleName, $activityID, $course->id);
$moduleinfo = update_moduleinfo($cm, $moduleinfo, $course); <-- Error
Thats how I try to update the entry.
I also found that post. Didn't help anything.
Moodle - Invalid course module ID
I found the issue myself:
$moduleinfo->introeditor['format'] = FORMAT_HTML;
$moduleinfo->introeditor['text'] = "INTRO TEXT";
$moduleinfo->coursemodule = $cm->id;
list($cm, $moduleinfo) = update_moduleinfo($cm, $moduleinfo, $course, null);
In order to use this function the above mentioned properties need to exist in order to perform a update.

How to replace deprecated SOBE Code in TYPO3 10.4

I inherited an old TYPO3 Extension using SOBE. As far as I unterstand it's deprecated, but it seems there is no documentation on how to replace it.
The Extension is using Backend Forms and the following line is throwing an error:
if (is_array($GLOBALS['SOBE']->editconf['tt_content']) && reset($GLOBALS['SOBE']->editconf['tt_content']) === 'new') {
The error is:
Cannot access protected property TYPO3\CMS\Backend\Controller\EditDocumentController::$editconf
The Var $GLOBALS['SOBE'] is still there, and there is also editconf, but it's not working.
How can I replace this code or rewrite it?
The SOBE object is part by part removed since years. As there are multiple ways for using it - see https://docs.typo3.org/c/typo3/cms-core/main/en-us/search.html?q=sobe&check_keywords=yes&area=default - you may need to take a closer look what is the exact part of replacing this code.
I would guess you can see more at https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.2/Deprecation-84195-ProtectedMethodsAndPropertiesInEditDocumentController.html?highlight=editconf.

Filter collapse issue on small screens

I am using Backpack for Laravel v4.1.10.
After the upgrade from v.4.0 the filter collapse button in small screens stopped working.
On button click my console error is:
TypeError: can't convert n to string
on the following line of bundle.js (line 9920 expanded):
if (!i && o.toggle && /show|hide/.test(n) && (o.toggle = !1), i || (i = new t(this, o), r.data('bs.collapse', i)), 'string' == typeof n)
Other info: php v7.3.9, Laravel v.7.16.1
Apparently it is not a framework bug as it is not existent in the live demo of backpack.
Any feedback to troubleshoot the issue is very welcome.
I fixed the issue by replacing the bundle.js file with the one provided in the official repository of backpack. Maybe it had not been updated at the version upgrade although I cannot fathom a reason for that.

what could I be missing in my typo3 extension to cause a table does not exist error?

I am getting this error after adding to an extension a class from another extension:
Uncaught TYPO3 Exception
#1247602160: Table 'deva.tx_bingoprizes_domain_model_hall' doesn't exist: SELECT tx_bingoprizes_domain_model_hall.* FROM tx_bingoprizes_domain_model_hall WHERE tx_bingoprizes_domain_model_hall.uid IN ('0') LIMIT 1
Tx_Extbase_Persistence_Storage_Exception_SqlError thrown in file
/home/typo3_src/typo3_src-4.5.32/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php in line 1008.
The class added is tx_bingoprizes_domain_model_hall which should be reading from the table tx_bpscore_domain_model_hall as I added to the setup file:
config.tx_extbase.persistence.classes {
Tx_Bingoprizes_Domain_Model_Hall {
mapping {
tableName = tx_bpscore_domain_model_hall
}
}
}
as I did for other extension which also reuses this class and which works properly ( I use it as my model for how to do this and as near as I can tell did everything the same way ). Why is typo3 still trying to use table tx_bingoprizes_domain_model_hall? where else do I need to specify the other table? I tried restarting the server, clearing caches, reinstalling the extension but still get the error.
I am using the latest 4.5 typo3.
Thanks
to reiterate my comment as the answer...
OK, I got it. Once again I had forgotten to INCLUDE the necessary item (in this case bingoprizes) to the page's template. So the error was not in my extension but in the typo3 config for the page. I hate that, forget it all the time, it is counter-intuitive to me as I find it natural to assume the setup.txt stuff is auto included on any page that uses my extension.

Zend_validate isValid() get stuck fatalError Maximum execution time of 30 seconds exceeded in /library/Zend/Validate/Hostname.php on line 608

Iam suffering from Zend_validate ,when ever I write a form and try to add validators , the only thing that works for me if I submit the form with no values , it will show error msg , but if I submit good values it will stuck for sometime and then give fatal error msg saying Maximum execution time 30 seconds is exceeded in /Applications/MAMP/htdocs/MyApplicationFolderName/library/Zend/Validate/Hostname.php on line 608
Please help my controller action code is
public function createAction()
{
// action body
$roleService=new User_Service_RoleService($this->em);
$userForm=new User_Form_UserForm($roleService->listAllRoleNames());
$userForm->startForm();
$userForm->setAction('create');
$userForm->setMethod('post');
if($this->getRequest()->isPost() )
{
if($userForm->isValid($this->getRequest()->getPost()))
{
$this->userAccountService->createUser($this->getRequest()->getParams());
$this->_forward('confirm');
}
}
$this->view->form=$userForm;
}
and my form class code is
class User_Form_UserForm extends Zend_Form {
//put your code here
private $roles;
public function __construct($options = null) {
parent::__construct($options);
$this->roles=$options;
}
public function startForm()
{
$idForm=new Zend_Form_Element_Hidden('id');
$this->addElement($idForm);
///////////
$userEmailForm=new Zend_Form_Element_Text('email');
$userEmailForm->setRequired(TRUE);
$userEmailForm->setLabel('Email');
$emailValidator=new Zend_Validate_EmailAddress();
// $emailValidator->setOptions(array('domain' => FALSE));
$userEmailForm->addValidator($emailValidator,false);
$userEmailForm->setAttrib('size', 25);
$userEmailForm->setFilters(array(new Zend_Filter_StringToLower(),
new Zend_Filter_StringTrim())
);
$this->addElement($userEmailForm);
}
}
This is small part of my form its so simple but not working Iam using MAMP PHP 5.3.5 because of Doctrine2 and name spaces
Please any help will be really appreciated .
Note I also tried other validators like string length and the same error showed.
"I actually just found the answer to this one:
The version of PHP 5.3 that ships with MAMP has a bug in
iconv_strlen() that causes a "do { ... } while (false);" loop in the
validator to run infinitely. I just switched my PHP version to 5.2, as
it's closer to production anyway, and it works. If you need the 5.3,
though, you will have to upgrade your PHP installation in MAMP. I
haven't tried it, but the following link was highly recommended:
http://www.davidgolding.net/cakephp/upgrading-php-in-mamp.html
Hope that all helps."
Source: http://forum.mamp.info/viewtopic.php?f=2&t=12189
I worked out the problem by not using mamp , and start using Zendserver CE free Edition http://www.zend.com/en/products/server-ce/downloads
, and by going through the steps described on this link http://www.witheringtree.com/2011/07/installing-zend-server-ce-on-os-x-a-guide-for-the-terminal-timid/
I could edit my root document for zend server to USERS/sites/
I run Zendframework validation and it worked nicely , I like mamp but I develope on Zend and zend use iconv_strlen() ,
the other way to solve this issue is by installing PHP but I found that not an easy solution , or you can use macports and I didnot want to go that way, since Iam using zendframework I needed something related to it so I used zendServer which is so far the cleanest solution .