Last modified: 2013-07-10 13:11:08 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 T52928, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50928 - TinyMCE_MW Extension don't handle headings with php 5.5. Problem with Hook ParserAfterTidy
TinyMCE_MW Extension don't handle headings with php 5.5. Problem with Hook Pa...
Status: UNCONFIRMED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.21.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: newphp
Depends on:
Blocks: 49975
  Show dependency treegraph
 
Reported: 2013-07-08 09:30 UTC by schoni92
Modified: 2013-07-10 13:11 UTC (History)
0 users

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


Attachments
malfunction in the ParserAfterTidy Hook (63.05 KB, text/plain)
2013-07-10 08:22 UTC, schoni92
Details

Description schoni92 2013-07-08 09:30:46 UTC
I installed in my Wiki the TinyMCE extension. The webhoster bplaced.net switched from the php Version 5.4 to 5.5. After that change the TinyMCE extension can't handle the headings from the Wikilanguage anymore, if there is some other stuff in the same line. The following code shall handle it (for example):

TinyMCE_MW.php:
 #====level 3====
while (preg_match("|====.*?====|is", $tinymcetext, $a)) 
{
  $value = implode(",", $a);
  $value = str_replace("====", "", $value);
  $r = preg_replace("|====.*?====|is", "<h4>".$value."</h4>", $a[0]);
  $tinymcetext = str_replace($a[0], html_entity_decode($r), $tinymcetext);
}

The attributs are valide, but the "====" isn't change to a <h4>-HTML-Tag, if the "===="-tag don't stand alone in a line. For example:
<p>====HEADING====</p>
This example isn't parse from the normal TinyMCE_MW extension. If the heading stands alone in a  line for example
....some stuff....
====HEADING====
....some other stuff....
it works fine.

A member of my Wikiadministrator stuff developed a workaround for this problem. You must comment the code form TinyMCE_MW.php and add some code in the parser.php:

/**
* Parse headers and return html
* @private
* @param $text string
* @return string
*/
function doHeadings( $text ) {
  wfProfileIn( __METHOD__ );
  ######################################################
  # Workaround by Kitty 
  # - Just go down to 2: h1 grabs a lot
  for ( $i = 6; $i >= 2; --$i ) {
    $h = str_repeat( '=', $i );

    # Pattern can be found everywhere. Removed ^ and $, added non greedy
    $text = preg_replace( "/$h(.+?)$h/m", "<h$i>\\1</h$i>", $text );

    # Resolve text  
    $text = htmlspecialchars_decode($text);
  }
  wfProfileOut( __METHOD__ );
  return $text;
}

This function is parsing the heading in the html-Tag. Maybe there is an other option for fix the problem.
Comment 1 schoni92 2013-07-10 08:22:17 UTC
Created attachment 12813 [details]
malfunction in the ParserAfterTidy Hook

The member, who developed the workaround has debugged the problem deep in the MediaWiki code. She said the following things:

1.) The malfunction is appeared at the ParserAfterTidy hook from the MediaWiki code.
2.) The hook calls two things. One of this things is the TinyMCE.
3.) After the call from TinyMCE the MediaWiki heading tags are switched in the HTML-Tags.
4.) After the call of the ParserAfterTidy hook the text has no changes.

In her opinion the out-parameter doesn't work correctly. In the attachment is an logfile names Fehlverhalten-im-Hook.txt, where an example is debugged for the malfunction without the workaround.

We hope, that u can fix the problem.

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


Navigation
Links