Index: includes/Parser.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/Parser.php,v retrieving revision 1.602 diff -c -r1.602 Parser.php *** includes/Parser.php 22 Mar 2006 04:57:14 -0000 1.602 --- includes/Parser.php 24 Mar 2006 14:52:21 -0000 *************** *** 303,324 **** } if( $tag == STRIP_COMMENTS ) { ! $start = '//'; } else { ! $start = "/<$tag(\\s+[^\\/>]*|\\s*)(\\/?)>/i"; $end = "/<\\/$tag\\s*>/i"; } ! while ( '' != $text ) { $p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE ); $stripped .= $p[0]; ! if( count( $p ) < 4 ) { break; } $attributes = $p[1]; ! $empty = $p[2]; ! $inside = $p[3]; $marker = $rnd . sprintf('%08X', $n++); $stripped .= $marker; --- 303,332 ---- } if( $tag == STRIP_COMMENTS ) { ! $start = '//'; } else { ! $start = "/<$tag(\\s+[^>]*|\\s*\/?)>/i"; $end = "/<\\/$tag\\s*>/i"; } ! while ( '' != $text ) { $p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE ); $stripped .= $p[0]; ! if( count( $p ) < 3 ) { break; } $attributes = $p[1]; ! $inside = $p[2]; ! ! // If $attributes ends with '/', we have an empty element tag, ! if ( $tag != STRIP_COMMENTS && substr( $attributes, -1 ) == '/' ) { ! $attributes = substr( $attributes, 0, -1); ! $empty = '/'; ! } ! else { ! $empty = ''; ! } $marker = $rnd . sprintf('%08X', $n++); $stripped .= $marker; *************** *** 327,333 **** $params[$marker] = Sanitizer::decodeTagAttributes( $attributes ); if ( $empty === '/' ) { - // Empty element tag, $content[$marker] = null; $text = $inside; } else { --- 335,340 ---- Index: maintenance/parserTests.txt =================================================================== RCS file: /cvsroot/wikipedia/phase3/maintenance/parserTests.txt,v retrieving revision 1.124 diff -c -r1.124 parserTests.txt *** maintenance/parserTests.txt 17 Mar 2006 01:02:14 -0000 1.124 --- maintenance/parserTests.txt 24 Mar 2006 14:52:21 -0000 *************** *** 3501,3506 **** --- 3501,3521 ---- !! end !! test + Parser hook: argument containing a forward slash (bug 5344) + !! input + + !! result +
+ string(0) ""
+ array(1) {
+   ["filename"]=>
+   string(8) "/tmp/bla"
+ }
+ 
+ + !! end + + !! test Parser hook: empty input using terminated empty elements (bug 2374) !! input text