Fixed Undefined index Errors After Conversion to XF2

skotos

Member
I just finished a conversion from vB4 to XF2 which had worked fine in a testbed, but on trying it for real I'm getting the following befuddling errors when I hit the main site:
  • ErrorException: [E_NOTICE] Undefined index: hh
  • src/XF/Criteria/Page.php:44
  • Generated by: Unknown account
  • Nov 15, 2018 at 12:05 PM
Stack trace
#0 src/XF/Criteria/Page.php(44): XF::handlePhpError(8, 'Undefined index...', '/var/www/rpgnet...', 44, Array)
#1 src/XF/Criteria/AbstractCriteria.php(53): XF\Criteria\Page->_matchBefore(Array, Object(Siropu\AdsManager\XF\Entity\User))
#2 src/XF/NoticeList.php(98): XF\Criteria\AbstractCriteria->isMatched(Object(Siropu\AdsManager\XF\Entity\User))
#3 src/XF/Pub/App.php(509): XF\NoticeList->addConditionalNotice(341, 'block', 'New rules have ...', Array)
#4 src/XF/Pub/App.php(446): XF\Pub\App->getNoticeList(Array)
#5 src/XF/App.php(1766): XF\Pub\App->renderPageHtml('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#6 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#7 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#8 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#9 src/XF.php(329): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}
Request state
array(4) {
["url"] => string(20) "/forums/xf/index.php"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
And:
  • ErrorException: [E_NOTICE] Undefined index: mm
  • src/XF/Criteria/Page.php:44
  • Generated by: Unknown account
  • Nov 15, 2018 at 12:05 PM
Stack trace
#0 src/XF/Criteria/Page.php(44): XF::handlePhpError(8, 'Undefined index...', '/var/www/rpgnet...', 44, Array)
#1 src/XF/Criteria/AbstractCriteria.php(53): XF\Criteria\Page->_matchBefore(Array, Object(Siropu\AdsManager\XF\Entity\User))
#2 src/XF/NoticeList.php(98): XF\Criteria\AbstractCriteria->isMatched(Object(Siropu\AdsManager\XF\Entity\User))
#3 src/XF/Pub/App.php(509): XF\NoticeList->addConditionalNotice(341, 'block', 'New rules have ...', Array)
#4 src/XF/Pub/App.php(446): XF\Pub\App->getNoticeList(Array)
#5 src/XF/App.php(1766): XF\Pub\App->renderPageHtml('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#6 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#7 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#8 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#9 src/XF.php(329): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}
Request state
array(4) {
["url"] => string(20) "/forums/xf/index.php"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
And:
  • Exception: DateTime::__construct(): Failed to parse time string (2018-10-30 :) at position 11 (:): Unexpected character
  • src/XF/Criteria/Page.php:44
  • Generated by: Unknown account
  • Nov 15, 2018 at 12:05 PM
Stack trace
#0 src/XF/Criteria/Page.php(44): DateTime->__construct('2018-10-30 :', Object(DateTimeZone))
#1 src/XF/Criteria/AbstractCriteria.php(53): XF\Criteria\Page->_matchBefore(Array, Object(Siropu\AdsManager\XF\Entity\User))
#2 src/XF/NoticeList.php(98): XF\Criteria\AbstractCriteria->isMatched(Object(Siropu\AdsManager\XF\Entity\User))
#3 src/XF/Pub/App.php(509): XF\NoticeList->addConditionalNotice(341, 'block', 'New rules have ...', Array)
#4 src/XF/Pub/App.php(446): XF\Pub\App->getNoticeList(Array)
#5 src/XF/App.php(1766): XF\Pub\App->renderPageHtml('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#6 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage('\n\t\n\n\n\n\n\n\n\n\n\n\n\n\t...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#7 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#8 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#9 src/XF.php(329): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}
Request state
array(4) {
["url"] => string(20) "/forums/xf/index.php"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
That trio shows up every time int he logs, while the page just says "An unexpected error occurred. Please try again later."

XF 2.0.10 and importer 1.2. PHP 5.6.33.
 
Look at the notices that were created by the import. It looks like one doesn't contain the expected information in the "Current date and time is before" page criteria. You will may need to re-specify that criteria.
 
Look at the notices that were created by the import. It looks like one doesn't contain the expected information in the "Current date and time is before" page criteria. You will may need to re-specify that criteria.
We had some problems with "Duplicate Keys" during the import process, which seemed to be a sequence of about 100 RSS-fed forum posts which somehow ended up duplicated:
  • XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '22222246' for key 'PRIMARY'
  • src/XF/Db/AbstractStatement.php:212
  • Generated by: Sandy
  • Nov 14, 2018 at 2:55 PM
The dupes were removed and the process continued on.

The only other errors that I see were the some RSS-related errors, since the RSS feeds were apparently running during the process, which might well explain the duplication:
  • XF\PrintableException: Job XF:Feeder: Please enter a valid URL.
  • src/XF/Service/Feed/Reader.php:35
  • Generated by: Unknown account
  • Nov 11, 2018 at 11:08 PM
And from there the first thing is the datetime/hh/mm sequence of errors.
 
It looks like one doesn't contain the expected information in the "Current date and time is before" page criteria. You will may need to re-specify that criteria.
I don't know what this means.

The upgrade script should have been run with all the checkmarks, plus an entry for the import_log_table. The imported posts seem to have postdates: 1010200649.
 
Sorry, when I said "notices", I meant our own system under Communication > Notices.
Gotcha!

Yes, if I turn off the Notices system, the pages load correctly, so hopefully it's something in there. I'm going to clean out a huge batch of old notices and see if that does the job. Thank you!
 
Which version of the "XenForo Importers" add-on are you using? Pretty sure we fixed this.

The version is listed in the Admin > Add-ons page.
 
And in case it's helpful for anyone's debugging: There were two notices that each had a start and end time that were passed and which were still active. It all looked right from the GUI, but when I reset those times from the GUI, everything started working correctly.
 
I believe I've identified the cause and have added some code into the XF core to prevent these sort of errors. I've also identified where this could happen in the importer (including another area) and made some tweaks there too for the next XFI release.
 
Back
Top Bottom