Last modified: 2013-11-14 14:31:53 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 T43735, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41735 - Notice given when TextContent constructed with $text = false should name caller
Notice given when TextContent constructed with $text = false should name caller
Status: NEW
Product: MediaWiki
Classification: Unclassified
ContentHandler (Other open bugs)
1.21.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 39480
  Show dependency treegraph
 
Reported: 2012-11-03 11:00 UTC by Niklas Laxström
Modified: 2013-11-14 14:31 UTC (History)
3 users (show)

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


Attachments

Description Niklas Laxström 2012-11-03 11:00:24 UTC
The following notice is not useful, because it does not name the caller nor give a backtrace.

[03-Nov-2012 10:49:34 UTC] PHP Notice:  TextContent constructed with $text = false! This may indicate an error in the caller's scope. [Called from TextContent::__construct in /www/translatewiki.net/w/includes/content/TextContent.php at line 37] in /www/translatewiki.net/w/includes/debug/Debug.php on line 283
Comment 1 Daniel Kinzler 2012-11-05 13:13:30 UTC
This uses wfWarn to issue a warning. If you want a traceback, set $wgDevelopmentWarnings to true. That triggers a PHP warning, which will be rendered to page output and/or written to the error log.

Where and when a traceback is included with a logged warning is a matter of configuring mediawiki and php.

Naming the caller is not practical, since the caller may just as well be ContentHandler::makeContent or something similarly unhelpful. To find the "interesting" caller, you really need a full stack trace.

Closing as WFM, because with $wgDevelopmentWarnings I see a stack trace. Note that $wgDevelopmentWarnings is enabled automatically in unit tests.
Comment 2 Niklas Laxström 2012-11-05 14:46:35 UTC
I'm sorry but what you are saying is not correct.

1) wfWarn has offset parameter to specify the caller. It might not always be useful, but showing TextContent::__construct is certainly not helpful.

2) $wgDevelopmentWarnings only decides whether to show the warning or not. By reading the code we can see that wfWarn calls only either wfDebug or trigger_error, and neither displays the backtrace with any MediaWiki configuration.

3) The only way to get PHP print backtraces for warnings and errors is the xdebug extension, which I don't have.
Comment 3 Daniel Kinzler 2012-11-05 15:05:11 UTC
For 1) i could set the offset to 2, which will provide slightly more info in some cases, but I doubt that it would be useful.

Items 2) and 3) are general issues with MediaWiki's warning/logging system. That could be improved, but that's unrelated to the issue at hand.
Comment 4 Niklas Laxström 2012-11-05 19:48:09 UTC
1) would be enough for me to close this bug. Another bug would be to optionally use wfBacktrace() in wfWarn.

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


Navigation
Links