r68212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68211‎ | r68212 | r68213 >
Date:10:16, 18 June 2010
Author:daniel
Status:deferred
Tags:
Comment:
' doesn't work, use ' instead
Modified paths:
  • /trunk/extensions/DataTransclusion/DataTransclusionHandler.php (modified) (history)
  • /trunk/extensions/DataTransclusion/tests/DataTransclusionTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransclusion/DataTransclusionHandler.php
@@ -296,7 +296,7 @@
297297 '!\]!' => ']',
298298 '!\{!' => '{',
299299 '!\}!' => '}',
300 - '!\'!' => ''',
 300+ '!\'!' => ''', //NOTE: ' doesn't work, mediawiki escapes it. maybe because it'S not in HTML 4.
301301 '!\|!' => '|',
302302 '!^\*!m' => '*',
303303 '!^#!m' => '#',
Index: trunk/extensions/DataTransclusion/tests/DataTransclusionTest.php
@@ -93,7 +93,7 @@
9494 $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo <bar>' ), 'foo &lt;bar&gt;' );
9595 $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo [[bar]]' ), 'foo &#91;&#91;bar&#93;&#93;' );
9696 $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo {{bar}}' ), 'foo &#123;&#123;bar&#125;&#125;' );
97 - $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo \'bar\'' ), 'foo &apos;bar&apos;' );
 97+ $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo \'bar\'' ), 'foo &#39;bar&#39;' );
9898 $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo|bar' ), 'foo&#124;bar' );
9999 $this->assertEquals( DataTransclusionHandler::sanitizeValue( '* foo bar' ), '&#42; foo bar' );
100100 $this->assertEquals( DataTransclusionHandler::sanitizeValue( 'foo*bar' ), 'foo*bar' );
@@ -237,7 +237,7 @@
238238 function testHandleRecordFunction() {
239239 global $wgDataTransclusionSources;
240240
241 - $data[] = array( "name" => "foo", "id" => "3", "info" => '<test>&[[X]]', "url" => 'http://test.org/', "evil" => 'javascript:alert("evil")' );
 241+ $data[] = array( "name" => "foo", "id" => "3", "info" => '<test>&[[X]]\'', "url" => 'http://test.org/', "evil" => 'javascript:alert("evil")' );
242242 $spec = array(
243243 'class' => 'FakeDataTransclusionSource',
244244 'data' => $data,
@@ -257,7 +257,7 @@
258258 $wgParser->parse( $text, $title, $options );
259259
260260 $html = $wgParser->getOutput()->getText();
261 - $this->assertEquals( $html, '<p>xx FOO:<b>3</b>|foo|Hallo|&lt;test&gt;&amp;&#91;&#91;X&#93;&#93;|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>' ); // XXX: should be more lenient wrt whitespace
 261+ $this->assertEquals( $html, '<p>xx FOO:<b>3</b>|foo|Hallo|&lt;test&gt;&amp;&#91;&#91;X&#93;&#93;&#39;|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>' ); // XXX: should be more lenient wrt whitespace
262262 $templates = $wgParser->getOutput()->getTemplates();
263263 $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) );
264264 }
@@ -265,7 +265,7 @@
266266 function testHandleRecordTag() {
267267 global $wgDataTransclusionSources;
268268
269 - $data[] = array( "name" => "foo", "id" => "3", "info" => '<test>&[[X]]', "url" => 'http://test.org/', "evil" => 'javascript:alert("evil")' );
 269+ $data[] = array( "name" => "foo", "id" => "3", "info" => '<test>&[[X]]\'', "url" => 'http://test.org/', "evil" => 'javascript:alert("evil")' );
270270 $spec = array(
271271 'class' => 'FakeDataTransclusionSource',
272272 'data' => $data,
@@ -285,7 +285,7 @@
286286 $wgParser->parse( $text, $title, $options );
287287
288288 $html = $wgParser->getOutput()->getText();
289 - $this->assertEquals( $html, '<p>xx FOO:<b>3</b>|foo|Hallo|&lt;test&gt;&amp;&#91;&#91;X&#93;&#93;|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>' ); // XXX: should be more lenient wrt whitespace
 289+ $this->assertEquals( $html, '<p>xx FOO:<b>3</b>|foo|Hallo|&lt;test&gt;&amp;&#91;&#91;X&#93;&#93;&#39;|<a href="http://test.org/" class="external text" rel="nofollow">link</a>|[javascript:alert("evil") click me] xx'."\n".'</p>' ); // XXX: should be more lenient wrt whitespace
290290 $templates = $wgParser->getOutput()->getTemplates();
291291 $this->assertTrue( isset( $templates[ NS_TEMPLATE ]['Test'] ) );
292292 }

Status & tagging log