Last modified: 2007-09-20 14:21:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11345 - Formatting problem: Included pages & Parser.php
Formatting problem: Included pages & Parser.php
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-09-15 01:09 UTC by Jonathan
Modified: 2007-09-20 14:21 UTC (History)
1 user (show)

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


Description Jonathan 2007-09-15 01:09:06 UTC
The HTML comments which are added to give details of include sizes interfere with proper use of cite.php. This is only the case where the page with the cite references is the INCLUDED page.

I have put some more detail here:
Comment 1 Brion Vibber 2007-09-17 19:58:47 UTC
I can't really tell what you mean; can you provide an example?
Comment 2 Jonathan 2007-09-17 21:08:23 UTC
Hi, I think my earlier message on meta goes in to a bit more detail:

I have just tried but couldn't replicate the error on the sandbox, as the "Pre-expand include size" message only appeared once. On my installation it appears after every reference - until I remove it from Parser.php.

I have just noticed on the message: "Note: The require_once() line needs to be placed near the end of the file." I must have skipped over this bit before as I have mine directly after require_once( "includes/DefaultSettings.php" ). Perhaps that causes the problem. I'll check it out but will post this for now.


Comment 3 Jonathan 2007-09-17 21:19:25 UTC
Moving the require_once() to the bottom [and simultaneously replacing the "pre-expand include size message] did not fix the problem. You probably could have told me that!

But it did let me cut and paste some of the source code, which might help you work out where I'm going wrong! I hope the text appears as plain text on this website.

<p>aaaaaaaaaaaa<a href="/ppp" title="ppp">sssssss</a> dddddddddddddddd <a href="/ppp" title="ppp">fffffffff</a> ggggggggggggggggggggg

</p><p>wwwwwwwwwwwwwwww<sup id="_ref-MHA_0" class="reference"><a href="#_note-MHA" title="">[2]</a></sup><!-- 
Pre-expand include size: 8053 bytes
Post-expand include size: 3581 bytes
Template argument size: 14 bytes
Maximum: 2097152 bytes
<pre>ddddddddddddddddddddd<sup id="_ref-MHA_1" class="reference"><a href="#_note-MHA" title="">[2]</a></sup><!-- 
<p>Pre-expand include size: 8053 bytes
Post-expand include size: 3581 bytes
Template argument size: 14 bytes
Maximum: 2097152 bytes
Comment 4 Brion Vibber 2007-09-18 15:56:04 UTC
Still can't make head or tail of this.

Please provide an example -- how you do you get it to do this? What's the EXACT text of the page(s) you write where it does this?

Can you provide a URL to your site where it does this? If not, can you cut and paste the EXACT wiki source code?
Comment 5 Jonathan 2007-09-18 17:51:27 UTC
Sorry Brian, looking back at what I wrote I can't blame you! I don't fancy having my website in google linked from this page, so I'm about to email you a link to the site. I put Parser.php back to normal so that the pages are broken. Best wishes
Comment 6 Brion Vibber 2007-09-19 19:50:42 UTC
Ok, I've taken a peek... Grabbed the page you referred to me off your wiki and tried to reproduce it locally on my test wiki, but I don't seem to encounter it locally.

The only place where the expansion size comments get inserted into the text is at the end of parsing, in Parser::parse(). You seem to be somehow getting them inserted at the boundary of every <ref>, and maybe in other places too... Further all of them have the same size values listed, which seems odd if there's a subparse or something going on. When I add extra test code on a local copy I get nothing there; the parse code doesn't get run at these points. The additions only come once at the very end of the page.

I'm testing with a stock MW 1.11.0 with Cite extension added in, w/ PHP 5.2.4rc2 which seems to more or less match yours (PHP 5.2.3). Have checked with $wgUseTidy both on and off. Tried copying all the templates and every page linked to from the page...

Is there anything in the wiki configuration that's different from standard? Is extensions/Cite the current SVN code or something older? Any non-standard configurations options in PHP?
Comment 7 Jonathan 2007-09-19 20:46:15 UTC
Brion, you were spot on with your suggestion - I was using an old version of Cite.php. That explains why it caused a problem initially when I upgraded to 1.8.2. I had wrongly assumed that the code hadn't changed, as says it works from version 1.6 up. I didn't realise there was a newer version. Sorry about that. Here's the difference between the two files I was using. Some of the comments relate to the exact problem I was having, and sound like the author was a bit frustrated too! Best wishes, Jonathan

diff Cite.php Cite_old.php
<  * @addtogroup Extensions
>  * @package MediaWiki
>  * @subpackage Extensions
<       'description' => 'Adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations',
<       'url' => ''
>       'description' => 'adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations',
>       'url' => ''
< $wgParserTestFiles[] = dirname( __FILE__ ) . "/citeParserTests.txt";
< require_once( dirname(__FILE__) . '/Cite.i18n.php' );
> require_once( 'Cite.i18n.php' );
<                               if ( ! isset( $this->mRefs[$key] ) || ! is_array( $this->mRefs[$key] ) ) {
>                               if ( ! @is_array( $this->mRefs[$key] ) ) {
<                               } else {
>                               } else
<                                       if ( $this->mRefs[$key]['text'] === null && $str !== '' ) {
<                                               // If no text found before, use this text
<                                               $this->mRefs[$key]['text'] = $str;
<                                       };
<                                               ); }
>                                               );
<                       if ( count( $this->mRefs ) == 0 )
<                               return '';
<                       if ( method_exists( $this->mParser, 'recursiveTagParse' ) ) {
<                               // New fast method
<                               return $this->mParser->recursiveTagParse( $in );
<                       } else {
<                               // Old method
<                               $ret = $this->mParser->parse(
<                                       $in,
<                                       $this->mParser->mTitle,
<                                       $this->mParser->mOptions,
<                                       // Avoid whitespace buildup
<                                       false,
<                                       // Important, otherwise $this->clearState()
<                                       // would get run every time <ref> or
<                                       // <references> is called, fucking the whole
<                                       // thing up.
<                                       false
<                               );
<                               $text = $ret->getText();
<                               return $this->fixTidy( $text );
<                       }
>                       $ret = $this->mParser->parse(
>                               $in,
>                               $this->mParser->mTitle,
>                               $this->mParser->mOptions,
>                               // Avoid whitespace buildup
>                               false,
>                               // Important, otherwise $this->clearState()
>                               // would get run every time <ref> or
>                               // <references> is called, fucking the whole
>                               // thing up.
>                               false
>                       );
>                       $text = $ret->getText();
>                       return $this->fixTidy( $text );
<                                               wfMsg( 'cite_error', $id, wfMsg( "cite_error_$id" ) ) .
>                                               wfMsgforContent( 'cite_error', $id, wfMsgForContent( "cite_error_$id" ) ) .
<                               return wfMsg( 'cite_error', $id );
>                               return wfMsgforContent( 'cite_error', $id );
> ?>
Comment 8 Jonathan 2007-09-19 20:49:33 UTC
Forgot to say thanks - Thanks. 
Comment 9 Brion Vibber 2007-09-20 14:21:03 UTC
Great. :)

Marking this as WORKSFORME since we got that resolved w/ current version.

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