Last modified: 2012-02-14 17:43:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34594, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32594 - SMW: [[Corresponds to::0 xxx]] causes divizion by zero, internal error message and PHP stack dump
SMW: [[Corresponds to::0 xxx]] causes divizion by zero, internal error messag...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-22 21:06 UTC by Van de Bugger
Modified: 2012-02-14 17:43 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Van de Bugger 2011-11-22 21:06:37 UTC
`[[Corresponds to::0 xxx]]' causes error message:

Warning: Division by zero in /var/www/ocw/mediawiki-1.17.1/extensions /SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php on line 30

and `Special:Internal error' with stack backtrace:

Initialisation value '' is not a number.

Backtrace:

#0 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Quantity.php(30): SMWDINumber->__construct(false, '_qty')
#1 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Number.php(110): SMWQuantityValue->convertToMainUnit(1, '????????')
#2 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php(169): SMWNumberValue->parseUserValue('1 ????????')
#3 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php(113): SMWDataValue->setUserValue('1 ????????', false)
#4 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php(177): SMWDataValueFactory::newTypeIdValue('_qty', '1 ????????', false, Object(SMWDIProperty), Object(SMWDIWikiPage))
#5 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_ParseData.php(113): SMWDataValueFactory::newPropertyObjectValue(Object(SMWDIProperty), '1 ????????', false, Object(SMWDIWikiPage))
#6 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php(165): SMWParseData::addProperty('Time to search', '1 ????????', false, Object(Parser), true)
#7 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php(112): SMWParserExtensions::parsePropertiesCallback(Array)
#8 [internal function]: SMWParserExtensions::simpleParsePropertiesCallback(Array)
#9 /var/www/ocw/mediawiki-1.17.1/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php(71): preg_replace_callback('/\[\[ ...', Array, '?* [[Time to se...')
#10 [internal function]: SMWParserExtensions::onInternalParseBeforeLinks(Object(Parser), '?* [[Time to se...', Object(StripState))
#11 /var/www/ocw/mediawiki-1.17.1/includes/Hooks.php(158): call_user_func_array(Array, Array)
#12 /var/www/ocw/mediawiki-1.17.1/includes/parser/Parser.php(1005): wfRunHooks('InternalParseBe...', Array)
#13 /var/www/ocw/mediawiki-1.17.1/includes/parser/Parser.php(283): Parser->internalParse('<!-- * [[Time t...')
#14 /var/www/ocw/mediawiki-1.17.1/includes/EditPage.php(1939): Parser->parse('<!-- * [[Time t...', Object(Title), Object(ParserOptions))
#15 /var/www/ocw/mediawiki-1.17.1/includes/EditPage.php(1218): EditPage->getPreviewText()
#16 /var/www/ocw/mediawiki-1.17.1/includes/EditPage.php(437): EditPage->showEditForm()
#17 /var/www/ocw/mediawiki-1.17.1/includes/EditPage.php(296): EditPage->edit()
#18 /var/www/ocw/mediawiki-1.17.1/includes/Wiki.php(522): EditPage->submit()
#19 /var/www/ocw/mediawiki-1.17.1/includes/Wiki.php(69): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#20 /var/www/ocw/mediawiki-1.17.1/index.php(114): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#21 {main}

Zero value for `Corresponds to' is a user mistake, but it should not cause SMW internal error with PHP stack dump.

BTW, I faced with problem by a mistake. I wrote `[[Corresponds to::0.001 km]]'. Looks pretty good, doesn't? But MW content language specifies decimal separator as comma, so `0.001 km' is parsed as number `0' and unit `.0001 km'. However, no warning or errors are show on property page. Instead, it causes stack dump on another page…
Comment 1 Jeroen De Dauw 2011-11-22 21:23:51 UTC
Yeah... SMW should drop Corresponds to 0 values and show a warning that it's doing this.
Comment 2 Markus Krötzsch 2012-02-11 17:54:18 UTC
Fixed in r111248. A warning is not shown though. I don't think this is really necessary in practice.
Comment 3 Van de Bugger 2012-02-14 17:43:49 UTC
Guys, I spend noticeable part of my life hunting for the bugs in software. I *know* -- good error messages and warnings are REALLY NECESSARY!

Look into the case again: 

[[Corresponds to::0.001 km]]

It looks perfect! Trouble appears in another page. It was PHP exception before, not to good, but at least it was the obvious signal that something goes wrong.

Now you *silently* ignore it, so users will spend hours trying to understand why `Corresponds to' DOES NOT WORK. They will be frustrated, they will apply for help, send messages to Semediawiki-user, and other people will spend time again... Why?

Ok, why do you show warnings if property value is invalid? For example:

[[Coordinates::foo]]

(where property `Coordinates' is of type `Geographic coordinate') will show small yellow triangle with exclamation sing and bubble "Failed to parse geographic coordinate: foo"? 

This is exactly the same case! User set property `Corresponds to' to value which is not understood. Why invalid value of `Coordinates' property shows warning, but `Corresponds to' -- does not? 

If you think it is not really necessary, let us drop all the warnings.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links