XF 2.2 [Bug with PHP 8.1] utf8_decode(): Passing null to parameter #1 ($string) of type string is deprecated

ZixDev

Member
Code:
ErrorException: [E_DEPRECATED] utf8_decode(): Passing null to parameter #1 ($string) of type string is deprecated
src/vendor/dokuwiki/utf8/utf8.php:141
 
Do you have a full stack trace please?

Note that this is only logged in debug mode and doesn’t halt execution so it’s more of a informational warning than a bug but it is something we will want to make changes for.
 
Do you have a full stack trace please?

Note that this is only logged in debug mode and doesn’t halt execution so it’s more of a informational warning than a bug but it is something we will want to make changes for.
Code:
Stack trace
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/Users/zix/Docu...', 141)
#1 src/vendor/dokuwiki/utf8/utf8.php(141): utf8_decode(NULL)
#2 src/addons/ZixVN/Exams/Service/Question/Preparer.php(236): utf8_strlen(NULL)
#3 src/addons/ZixVN/Exams/Service/Question/Preparer.php(214): ZixVN\Exams\Service\Question\Preparer->performSave()
#4 src/addons/ZixVN/Exams/Service/Question/Editor.php(83): ZixVN\Exams\Service\Question\Preparer->afterUpdate()
#5 src/XF/Service/ValidateAndSavableTrait.php(42): ZixVN\Exams\Service\Question\Editor->_save()
#6 src/addons/ZixVN/Exams/ControllerPlugin/Question.php(126): ZixVN\Exams\Service\Question\Editor->save()
#7 src/addons/LilTee/ExtendExams/ZixVN/Exams/ControllerPlugin/Question.php(20): ZixVN\Exams\ControllerPlugin\Question->saveQuestionProcess(Object(ZixVN\Exams\Service\Question\Editor))
#8 src/addons/ZixVN/Exams/Pub/Controller/Question.php(130): LilTee\ExtendExams\ZixVN\Exams\ControllerPlugin\Question->saveQuestionProcess(Object(ZixVN\Exams\Service\Question\Editor))
#9 src/addons/LilTee/ExtendExams/ZixVN/Exams/Pub/Controller/Question.php(417): ZixVN\Exams\Pub\Controller\Question->actionEdit(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(352): LilTee\ExtendExams\ZixVN\Exams\Pub\Controller\Question->actionEdit(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('ZixVN\\Exams:Que...', 'Edit', Object(XF\Mvc\RouteMatch), Object(LilTee\MediaRelationships\ZixVN\Exams\Pub\Controller\Question), NULL)
#12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(LilTee\MediaRelationships\ZixVN\Exams\Pub\Controller\Question), NULL)
#13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#15 src/XF.php(517): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}

There are lines 236, 237, 238 on: src/addons/ZixVN/Exams/Service/Question/Preparer.php
Code:
                if (\utf8_strlen($option->getOption()->content) < 1) {
                    continue;
                }
 
Yes I'd make changes in your own code to account for this. We theoretically could make changes to the underlying library but if this was the native strlen function being used then the same issue would exist and you'd have to make changes to account for it.
 
Top Bottom