Seb35 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/297538

Change subject: Protect section headers against regex syntaxes in forms
......................................................................

Protect section headers against regex syntaxes in forms

Section headers like 'A / B' were badly recognized because of the slash; this
fixes this issue. I checked others preg_* in the file also; it was the sole 
place.

Change-Id: I84cece3172912609e20740a40d22bbd98b23a253
---
M includes/SF_FormPrinter.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/38/297538/1

diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index 4a39367..dc156eb 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -1205,7 +1205,7 @@
                                                        
$tag_components_next_section = SFUtils::getFormTagComponents( 
$bracketed_string_next_section );
                                                        $tag_title_next_section 
= trim( $tag_components_next_section[0] );
                                                        if ( 
$tag_title_next_section == 'section' ) {
-                                                               if ( 
preg_match( '/(^={1,6}[ ]*?' . $tag_components_next_section[1] . '[ 
]*?={1,6}\s*?$)/m', $existing_page_content, $matches, PREG_OFFSET_CAPTURE ) ) {
+                                                               if ( 
preg_match( '/(^={1,6}[ ]*?' . preg_quote( $tag_components_next_section[1], '/' 
) . '[ ]*?={1,6}\s*?$)/m', $existing_page_content, $matches, 
PREG_OFFSET_CAPTURE ) ) {
                                                                        
$section_end_loc = $matches[0][1];
                                                                }
                                                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/297538
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84cece3172912609e20740a40d22bbd98b23a253
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Seb35 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to