Fixed ErrorException: [E_WARNING] Attempt to read property "version_string" on null src/addons/XFRM/Entity/ResourceItem.php:1952

GameNet

Active member
Affected version
XF 2.3
Hi

I am receiving errors when I tried to post a resource on one of my website using the webhook.

Here my current setup
Screenshot 2024-07-09 at 4.55.44 PM.webpScreenshot 2024-07-09 at 4.55.22 PM.webp

Error code:
Code:
ErrorException: [E_WARNING] Attempt to read property "version_string" on null src/addons/XFRM/Entity/ResourceItem.php:1952
Generated by: NICK97 Jul 9, 2024 at 4:50 PM
Stack trace
#0 src/addons/XFRM/Entity/ResourceItem.php(1952): XF::handlePhpError(2, '[E_WARNING] Att...', '/home/citiesmod...', 1952)
#1 src/XF/Mvc/Entity/Entity.php(582): XFRM\Entity\ResourceItem->setupApiResultData(Object(XF\Api\Result\EntityResult), 1, Array)
#2 src/XF/Repository/WebhookRepository.php(113): XF\Mvc\Entity\Entity->toWebhookResult()
#3 src/XF/Behavior/Webhook.php(34): XF\Repository\WebhookRepository->queueWebhook('resource', 33, 'insert', Object(XFRM\Entity\ResourceItem))
#4 src/XF/Mvc/Entity/Entity.php(1327): XF\Behavior\Webhook->postSave()
#5 src/addons/XFRM/Service/ResourceItem/Create.php(302): XF\Mvc\Entity\Entity->save(true, false)
#6 src/XF/Service/ValidateAndSavableTrait.php(42): XFRM\Service\ResourceItem\Create->_save()
#7 src/addons/XFRM/Pub/Controller/Category.php(277): XFRM\Service\ResourceItem\Create->save()
#8 src/XF/Mvc/Dispatcher.php(362): XFRM\Pub\Controller\Category->actionAdd(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XFRM:Category', 'Add', Object(XF\Mvc\RouteMatch), Object(XFRM\Pub\Controller\Category), NULL)
#10 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XFRM\Pub\Controller\Category), NULL)
#11 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2777): XF\Mvc\Dispatcher->run()
#13 src/XF.php(798): XF\App->run()
#14 index.php(23): XF::runApp('XF\\Pub\\App')
#15 {main}
Request state
array(4) {
  ["url"] => string(41) "/resources/categories/security-2-x.28/add"
  ["referrer"] => string(65) "https://tyleraustins.com/resources/categories/security-2-x.28/add"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(19) {
    ["_xfToken"] => string(8) "********"
    ["prefix_id"] => string(1) "5"
    ["title"] => string(6) "test 1"
    ["tag_line"] => string(19) "this is just a test"
    ["resource_type"] => string(14) "download_local"
    ["version_attachment_hash"] => string(32) "6f71940f43a22897a5756d56fb26559a"
    ["version_attachment_hash_combined"] => string(107) "{"type":"resource_version","context":{"resource_category_id":28},"hash":"6f71940f43a22897a5756d56fb26559a"}"
    ["version_string"] => string(4) "v1.0"
    ["custom_fields"] => array(11) {
      ["xfrm_xf2_versions"] => array(1) {
        [0] => string(2) "04"
      }
      ["xf_additional_requirement"] => string(6) "XF 2.3"
      ["xfrm_license"] => string(2) "01"
      ["xf_visible_branding"] => string(2) "02"
      ["InstallationUsageProxy"] => string(2) "01"
      ["xf_github_repo"] => string(0) ""
      ["xfrm_related_resources_html"] => string(0) ""
      ["xfrm_faq_html"] => string(0) ""
      ["xfrm_howtoinstall_html"] => string(0) ""
      ["xfcustomaddon_html"] => string(0) ""
      ["xfrm_planned_html"] => string(0) ""
    }
    ["description_html"] => string(252) "<p>this is just a test for web hook setup</p><p><br></p><p><br></p><p><img src="/attachments/countriesxltv_tvosicon-webp.551/?hash=8b9531c1875650523b2a4b0dc16faab9" data-attachment="full:551" alt="CountriesXLTV_tvOSIcon.webp" class="fr-fic fr-dii"></p>"
    ["attachment_hash"] => string(32) "8b9531c1875650523b2a4b0dc16faab9"
    ["attachment_hash_combined"] => string(106) "{"type":"resource_update","context":{"resource_category_id":28},"hash":"8b9531c1875650523b2a4b0dc16faab9"}"
    ["tags"] => string(0) ""
    ["external_url"] => string(0) ""
    ["alt_support_url"] => string(0) ""
    ["icon_action"] => string(6) "custom"
    ["_xfRequestUri"] => string(41) "/resources/categories/security-2-x.28/add"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFRM release (2.3.1).

Change log:
Fix sending webhook when resource does not have a version
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom