Page MenuHomePhabricator

FormatMetadata::flattenArrayReal() can be called with a single non-zero key
Closed, DuplicatePublic

Description

While running SMW's rebuildData.php on a database without the images directory present (but with EXIF enabled in SemanticExtraSpecialProperties), I ended up getting multiple E_NOTICE messages:

Trying to understand the what was going on, I put a var_dump($val) just before an exception to generate a backtrace. Here was the result.

array(1) {
  ["_MW_PNG_VERSION"]=>
  &string(1) "1"
}
[d7b7dda2d1c1668ddc700dbe] [no req]   MWException from line 1051 of .../includes/media/FormatMetadata.php: bldh
Backtrace:
#0 .../includes/media/FormatMetadata.php(987): FormatMetadata->flattenArrayReal(array, string)
#1 .../includes/media/FormatMetadata.php(88): FormatMetadata->makeFormattedData(array)
#2 .../extensions/SemanticExtraSpecialProperties/src/PropertyAnnotators/ExifPropertyAnnotator.php(137): FormatMetadata::getFormattedData(array)
#3 .../extensions/SemanticExtraSpecialProperties/src/PropertyAnnotators/ExifPropertyAnnotator.php(113): SESP\PropertyAnnotators\ExifPropertyAnnotator->addExifDataTo(SMW\DataModel\ContainerSemanticData, array)
#4 .../extensions/SemanticExtraSpecialProperties/src/PropertyAnnotators/ExifPropertyAnnotator.php(100): SESP\PropertyAnnotators\ExifPropertyAnnotator->getDataItemFromExifData(SMW\DIWikiPage, array)
#5 .../extensions/SemanticExtraSpecialProperties/src/PropertyAnnotators/DispatchingPropertyAnnotator.php(73): SESP\PropertyAnnotators\ExifPropertyAnnotator->addAnnotation(SMW\DIProperty, SMW\SemanticData)
#6 .../extensions/SemanticExtraSpecialProperties/src/ExtraPropertyAnnotator.php(72): SESP\PropertyAnnotators\DispatchingPropertyAnnotator->addAnnotation(SMW\DIProperty, SMW\SemanticData)
#7 .../extensions/SemanticExtraSpecialProperties/src/HookRegistry.php(158): SESP\ExtraPropertyAnnotator->addAnnotation(SMW\SemanticData)
#8 .../includes/Hooks.php(177): SESP\HookRegistry->SESP\{closure}(SMWSQLStore3, SMW\SemanticData)
#9 .../includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#10 .../extensions/SemanticMediaWiki/includes/storage/SMW_Store.php(218): Hooks::run(string, array)
#11 .../extensions/SemanticMediaWiki/includes/StoreUpdater.php(218): SMW\Store->updateData(SMW\SemanticData)
#12 .../extensions/SemanticMediaWiki/includes/StoreUpdater.php(142): SMW\StoreUpdater->doRealUpdate()
#13 .../extensions/SemanticMediaWiki/includes/StoreUpdater.php(96): SMW\StoreUpdater->doPerformUpdate()
#14 .../extensions/SemanticMediaWiki/includes/ParserData.php(406): SMW\StoreUpdater->doUpdate()
#15 [internal function]: SMW\ParserData->SMW\{closure}()
#16 .../extensions/SemanticMediaWiki/src/Updater/DeferredCallableUpdate.php(236): call_user_func(Closure)
#17 .../extensions/SemanticMediaWiki/src/Updater/TransactionalDeferredCallableUpdate.php(134): SMW\Updater\DeferredCallableUpdate->doUpdate()
#18 .../extensions/SemanticMediaWiki/src/Updater/DeferredCallableUpdate.php(265): SMW\Updater\TransactionalDeferredCallableUpdate->doUpdate()
#19 .../extensions/SemanticMediaWiki/includes/ParserData.php(422): SMW\Updater\DeferredCallableUpdate->pushUpdate()
#20 .../extensions/SemanticMediaWiki/src/MediaWiki/Jobs/UpdateJob.php(184): SMW\ParserData->updateStore()
#21 .../extensions/SemanticMediaWiki/src/MediaWiki/Jobs/UpdateJob.php(146): SMW\MediaWiki\Jobs\UpdateJob->updateStore(SMW\ParserData)
#22 .../extensions/SemanticMediaWiki/src/MediaWiki/Jobs/UpdateJob.php(118): SMW\MediaWiki\Jobs\UpdateJob->needToParsePageContentBeforeUpdate()
#23 .../extensions/SemanticMediaWiki/src/MediaWiki/Jobs/UpdateJob.php(86): SMW\MediaWiki\Jobs\UpdateJob->doPrepareForUpdate()
#24 .../extensions/SemanticMediaWiki/src/MediaWiki/Jobs/UpdateJob.php(67): SMW\MediaWiki\Jobs\UpdateJob->doUpdate()
#25 .../extensions/SemanticMediaWiki/src/SQLStore/EntityRebuildDispatcher.php(204): SMW\MediaWiki\Jobs\UpdateJob->run()
#26 .../extensions/SemanticMediaWiki/src/Maintenance/DataRebuilder.php(307): SMW\SQLStore\EntityRebuildDispatcher->startRebuildWith(integer)
#27 .../extensions/SemanticMediaWiki/src/Maintenance/DataRebuilder.php(266): SMW\Maintenance\DataRebuilder->doExecuteFor(SMW\SQLStore\EntityRebuildDispatcher, integer)
#28 .../extensions/SemanticMediaWiki/src/Maintenance/DataRebuilder.php(168): SMW\Maintenance\DataRebuilder->doRebuildAll()
#29 .../extensions/SemanticMediaWiki/maintenance/rebuildData.php(152): SMW\Maintenance\DataRebuilder->rebuild()
#30 .../maintenance/doMaintenance.php(94): SMW\Maintenance\RebuildData->execute()
#31 .../extensions/SemanticMediaWiki/maintenance/rebuildData.php(200): require_once(string)
#32 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 5 2018, 12:02 AM

Sounds like T87572

It seems FormatMetadata::flattenArrayReal is not safe to be called for non-numeric keys

MarkAHershberger closed this task as Declined.Jan 5 2018, 12:57 AM

dupe of T87572