Page MenuHomePhabricator

VikiTitleIcon/ ApiGetTitleIcons.php: Undefined class constant 'TYPE_STRING'
Open, Needs TriagePublic

Description

2020-07-17 16:30:09 ... wiki-wiki1: [446cdc05a165ebc6c117f6ba] /w/api.php?action=getTitleIcons&format=json&pageTitle=Risk%20management%20(work%20instruction) Error from line 80 of .../extensions/VikiTitleIcon/ApiGetTitleIcons.php: Undefined class constant 'TYPE_STRING'
#0 .../extensions/VikiTitleIcon/ApiGetTitleIcons.php(37): ApiGetTitleIcons->getPropertyValues(Title, string)
#1 .../includes/api/ApiMain.php(1598): ApiGetTitleIcons->execute()
#2 .../includes/api/ApiMain.php(537): ApiMain->executeAction()
#3 .../includes/api/ApiMain.php(508): ApiMain->executeActionWithErrorHandling()
#4 .../api.php(87): ApiMain->execute()
#5 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 17 2020, 7:20 PM
		$strings = array();
		foreach ( $values as $value ) {
			if ( $value->getDIType() == SMWDataItem::TYPE_STRING ||
				$value->getDIType() == SMWDataItem::TYPE_BLOB ) {
				$strings[] = trim( $value->getString() );
			}
		}

The refered class seems SMWDataItem

When looking at the documentation there is no such constant - https://doc.semantic-mediawiki.org/classSMWDataItem.html

I have found an archive page where it is mention, seems the same as the blob - https://www.semantic-mediawiki.org/wiki/Archive:Database_tables#Normal_Property_Tables

But I have no idea about SMW and when it was removed.

The change was made in SMW 3.0.0. This can be fixed as was done in TitleIcon [0]:

			if ( ( defined( 'SMWDataItem::TYPE_STRING' ) &&
				$value->getDIType() == SMWDataItem::TYPE_STRING ) ||
 				$value->getDIType() == SMWDataItem::TYPE_BLOB ) {
 				$strings[] = trim( $value->getString() );
 			}

[0] https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/TitleIcon/+/1aa1e67a6e383dea5e827b6031916ec3af19882b%5E%21/#F0