Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.4
Description
After fetch content in custom controller, during a rendering of a results API returns an error:
vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/XmlTextStorage/Gateway/LegacyStorage.php
line: 95
ContextErrorException
Undefined offset: 14179
on
private 'context' => array (size=6) 'field' => object(eZ\Publish\SPI\Persistence\Content\Field)[1124] public 'id' => int 34352 public 'fieldDefinitionId' => int 395 public 'type' => string 'ezxmltext' (length=9) public 'value' => object(eZ\Publish\SPI\Persistence\Content\FieldValue)[1129] ... public 'languageCode' => string 'eng-US' (length=6) public 'versionNo' => int 1 'linkIds' => array (size=1) 14179 => boolean true 'linkTags' => object(DOMNodeList)[1184] 'link' => object(DOMElement)[1185] 'urlId' => string '14179' (length=5) 'linkIdUrlMap' => array (size=0) empty
After investigation:
- offset is undefined in urls array, which contains urls for content. Url 14179 belongs to content 3033 (article) and is missing in the database:
(SELECT * FROM `ezurl` WHERE `id` = 14179)
To reproduce the bug try to remove url for content.
Exception:
<?xml version="1.0" encoding="UTF-8"?> <ErrorMessage media-type="application/vnd.ez.api.ErrorMessage+xml"> <errorCode>500</errorCode> <errorMessage>Internal Server Error</errorMessage> <errorDescription>Notice: Undefined offset: 14179</errorDescription> <trace>#0 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/XmlTextStorage/Gateway/LegacyStorage.php(95): Symfony\Component\Debug\ErrorHandler->handleError(8, 'Undefined offse...', '/var/www/amnh/v...', 95, Array) #1 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/XmlTextStorage.php(42): eZ\Publish\Core\FieldType\XmlText\XmlTextStorage\Gateway\LegacyStorage->getFieldData(Object(eZ\Publish\SPI\Persistence\Content\Field)) #2 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/StorageHandler.php(95): eZ\Publish\Core\FieldType\XmlText\XmlTextStorage->getFieldData(Object(eZ\Publish\SPI\Persistence\Content\VersionInfo), Object(eZ\Publish\SPI\Persistence\Content\Field), Array) #3 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/FieldHandler.php(340): eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler->getFieldData(Object(eZ\Publish\SPI\Persistence\Content\VersionInfo), Object(eZ\Publish\SPI\Persistence\Content\Field)) #4 /var/www/amnh/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php(35055): eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler->loadExternalFieldData(Object(eZ\Publish\SPI\Persistence\Content)) #5 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php(330): eZPublishCorePersistenceLegacyContentFieldHandler_000000001ac7e0e4000000006d588310->loadExternalFieldData(Object(eZ\Publish\SPI\Persistence\Content)) #6 /var/www/amnh/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php(35323): eZ\Publish\Core\Persistence\Legacy\Content\Handler->load(3033, 1, NULL) #7 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Cache/ContentHandler.php(70): eZPublishCorePersistenceLegacyContentHandler_000000001ac7e0d0000000006d588310->load(3033, 1, NULL) #8 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php(409): eZ\Publish\Core\Persistence\Cache\ContentHandler->load(3033, 1, NULL) #9 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php(343): eZ\Publish\Core\Repository\ContentService->internalLoadContent(3033, NULL, NULL, false, true) #10 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/SearchService.php(145): eZ\Publish\Core\Repository\ContentService->loadContent(3033, NULL, NULL, true) #11 /var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/SearchService.php(68): eZ\Publish\Core\Repository\SearchService->findContent(Object(eZ\Publish\API\Repository\Values\Content\Query), Array, true) #12 /var/www/amnh/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php(33415): eZ\Publish\Core\SignalSlot\SearchService->findContent(Object(eZ\Publish\API\Repository\Values\Content\Query), Array, true) #13 /var/www/amnh/src/EzSystems/RecommendationBundle/Rest/Controller/ContentController.php(100): eZPublishCoreRepositorySearchService_000000001ac7e3d7000000006d588310->findContent(Object(eZ\Publish\API\Repository\Values\Content\Query)) #14 [internal function]: EzSystems\RecommendationBundle\Rest\Controller\ContentController->getContent('3033') #15 /var/www/amnh/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(145): call_user_func_array(Array, Array) #16 /var/www/amnh/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #17 /var/www/amnh/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/amnh/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(186): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/amnh/web/index.php(77): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #20 {main}</trace> <file>/var/www/amnh/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/XmlTextStorage/Gateway/LegacyStorage.php</file> <line>95</line>