Pete Cuff
New member
Hi am running into the internal error below, even though I am specifying the username parameter: https://screencast-o-matic.com/screenshots/u/hh9M/1575889079384-12707.png . User is a superuser, posting to /api/resources/ to create a new resource. Other API calls set up and working; e.g. get resource by ID, same credentials being used. Any ideas on what else to try/set much appreciated.
---
Server error log
#0 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'username', 5, Array)
#1 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('username', NULL)
#2 src/addons/XFRM/Service/ResourceItem/Create.php(81): XF\Mvc\Entity\Entity->__set('username', NULL)
#3 src/addons/XFRM/Service/ResourceItem/Create.php(57): XFRM\Service\ResourceItem\Create->setupDefaults()
#4 src/XF/Container.php(270): XFRM\Service\ResourceItem\Create->__construct(Object(XF\Api\App), Object(XFRM\Entity\Category))
#5 src/XF/App.php(1570): XF\Container->createObject('XFRM\\Service\\Re...', Array)
#6 src/XF/Container.php(228): XF\App->XF\{closure}('XFRM\\Service\\Re...', Array, Object(XF\Container))
#7 src/XF/App.php(2776): XF\Container->create('service', 'XFRM:ResourceIt...', Array)
#8 [internal function]: XF\App->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#9 src/XF/Mvc/Controller.php(738): call_user_func_array(Array, Array)
#10 src/addons/XFRM/Api/Controller/ResourceItems.php(124): XF\Mvc\Controller->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#11 src/addons/XFRM/Api/Controller/ResourceItems.php(73): XFRM\Api\Controller\ResourceItems->setupResourceCreate(Object(XFRM\Entity\Category))
#12 src/XF/Mvc/Dispatcher.php(350): XFRM\Api\Controller\ResourceItems->actionPost(Object(XF\Mvc\ParameterBag))
#13 src/XF/Api/Mvc/Dispatcher.php(27): XF\Mvc\Dispatcher->dispatchClass('XFRM:ResourceIt...', 'Post', Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#14 src/XF/Mvc/Dispatcher.php(113): XF\Api\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#15 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Api\Mvc\RouteMatch))
#16 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#17 src/XF.php(391): XF\App->run()
#18 index.php(16): XF::runApp('XF\\Api\\App')
#19 {main}
-------------
Previous InvalidArgumentException: Attempted to convert NULL to string/binary - src/XF/Mvc/Entity/ValueFormatter.php:130
#0 src/XF/Mvc/Entity/Entity.php(736): XF\Mvc\Entity\ValueFormatter->castValueToType(NULL, 5, Array)
#1 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'username', 5, Array)
#2 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('username', NULL)
#3 src/addons/XFRM/Service/ResourceItem/Create.php(81): XF\Mvc\Entity\Entity->__set('username', NULL)
#4 src/addons/XFRM/Service/ResourceItem/Create.php(57): XFRM\Service\ResourceItem\Create->setupDefaults()
#5 src/XF/Container.php(270): XFRM\Service\ResourceItem\Create->__construct(Object(XF\Api\App), Object(XFRM\Entity\Category))
#6 src/XF/App.php(1570): XF\Container->createObject('XFRM\\Service\\Re...', Array)
#7 src/XF/Container.php(228): XF\App->XF\{closure}('XFRM\\Service\\Re...', Array, Object(XF\Container))
#8 src/XF/App.php(2776): XF\Container->create('service', 'XFRM:ResourceIt...', Array)
#9 [internal function]: XF\App->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#10 src/XF/Mvc/Controller.php(738): call_user_func_array(Array, Array)
#11 src/addons/XFRM/Api/Controller/ResourceItems.php(124): XF\Mvc\Controller->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#12 src/addons/XFRM/Api/Controller/ResourceItems.php(73): XFRM\Api\Controller\ResourceItems->setupResourceCreate(Object(XFRM\Entity\Category))
#13 src/XF/Mvc/Dispatcher.php(350): XFRM\Api\Controller\ResourceItems->actionPost(Object(XF\Mvc\ParameterBag))
#14 src/XF/Api/Mvc/Dispatcher.php(27): XF\Mvc\Dispatcher->dispatchClass('XFRM:ResourceIt...', 'Post', Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#15 src/XF/Mvc/Dispatcher.php(113): XF\Api\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#16 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Api\Mvc\RouteMatch))
#17 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#18 src/XF.php(391): XF\App->run()
#19 index.php(16): XF::runApp('XF\\Api\\App')
#20 {main}
---
Server error log
- InvalidArgumentException: Attempted to convert NULL to string/binary [username]
- src/XF/Mvc/Entity/Entity.php:740
- Generated by: Unknown account
- Dec 9, 2019 at 5:49 AM
#0 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'username', 5, Array)
#1 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('username', NULL)
#2 src/addons/XFRM/Service/ResourceItem/Create.php(81): XF\Mvc\Entity\Entity->__set('username', NULL)
#3 src/addons/XFRM/Service/ResourceItem/Create.php(57): XFRM\Service\ResourceItem\Create->setupDefaults()
#4 src/XF/Container.php(270): XFRM\Service\ResourceItem\Create->__construct(Object(XF\Api\App), Object(XFRM\Entity\Category))
#5 src/XF/App.php(1570): XF\Container->createObject('XFRM\\Service\\Re...', Array)
#6 src/XF/Container.php(228): XF\App->XF\{closure}('XFRM\\Service\\Re...', Array, Object(XF\Container))
#7 src/XF/App.php(2776): XF\Container->create('service', 'XFRM:ResourceIt...', Array)
#8 [internal function]: XF\App->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#9 src/XF/Mvc/Controller.php(738): call_user_func_array(Array, Array)
#10 src/addons/XFRM/Api/Controller/ResourceItems.php(124): XF\Mvc\Controller->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#11 src/addons/XFRM/Api/Controller/ResourceItems.php(73): XFRM\Api\Controller\ResourceItems->setupResourceCreate(Object(XFRM\Entity\Category))
#12 src/XF/Mvc/Dispatcher.php(350): XFRM\Api\Controller\ResourceItems->actionPost(Object(XF\Mvc\ParameterBag))
#13 src/XF/Api/Mvc/Dispatcher.php(27): XF\Mvc\Dispatcher->dispatchClass('XFRM:ResourceIt...', 'Post', Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#14 src/XF/Mvc/Dispatcher.php(113): XF\Api\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#15 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Api\Mvc\RouteMatch))
#16 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#17 src/XF.php(391): XF\App->run()
#18 index.php(16): XF::runApp('XF\\Api\\App')
#19 {main}
-------------
Previous InvalidArgumentException: Attempted to convert NULL to string/binary - src/XF/Mvc/Entity/ValueFormatter.php:130
#0 src/XF/Mvc/Entity/Entity.php(736): XF\Mvc\Entity\ValueFormatter->castValueToType(NULL, 5, Array)
#1 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(NULL, 'username', 5, Array)
#2 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('username', NULL)
#3 src/addons/XFRM/Service/ResourceItem/Create.php(81): XF\Mvc\Entity\Entity->__set('username', NULL)
#4 src/addons/XFRM/Service/ResourceItem/Create.php(57): XFRM\Service\ResourceItem\Create->setupDefaults()
#5 src/XF/Container.php(270): XFRM\Service\ResourceItem\Create->__construct(Object(XF\Api\App), Object(XFRM\Entity\Category))
#6 src/XF/App.php(1570): XF\Container->createObject('XFRM\\Service\\Re...', Array)
#7 src/XF/Container.php(228): XF\App->XF\{closure}('XFRM\\Service\\Re...', Array, Object(XF\Container))
#8 src/XF/App.php(2776): XF\Container->create('service', 'XFRM:ResourceIt...', Array)
#9 [internal function]: XF\App->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#10 src/XF/Mvc/Controller.php(738): call_user_func_array(Array, Array)
#11 src/addons/XFRM/Api/Controller/ResourceItems.php(124): XF\Mvc\Controller->service('XFRM:ResourceIt...', Object(XFRM\Entity\Category))
#12 src/addons/XFRM/Api/Controller/ResourceItems.php(73): XFRM\Api\Controller\ResourceItems->setupResourceCreate(Object(XFRM\Entity\Category))
#13 src/XF/Mvc/Dispatcher.php(350): XFRM\Api\Controller\ResourceItems->actionPost(Object(XF\Mvc\ParameterBag))
#14 src/XF/Api/Mvc/Dispatcher.php(27): XF\Mvc\Dispatcher->dispatchClass('XFRM:ResourceIt...', 'Post', Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#15 src/XF/Mvc/Dispatcher.php(113): XF\Api\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Api\Mvc\RouteMatch), Object(XFRM\Api\Controller\ResourceItems), NULL)
#16 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Api\Mvc\RouteMatch))
#17 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#18 src/XF.php(391): XF\App->run()
#19 index.php(16): XF::runApp('XF\\Api\\App')
#20 {main}
Last edited: