r80573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80572‎ | r80573 | r80574 >
Date:16:27, 19 January 2011
Author:platonides
Status:deferred
Tags:
Comment:
Since r80461 preprocessToObj() may return NULL with the error code in the len.
Translate into a userland exception.
Modified paths:
  • /trunk/extensions/NativePreprocessor/mediawiki_preprocessor.c (modified) (history)

Diff [purge]

Index: trunk/extensions/NativePreprocessor/mediawiki_preprocessor.c
@@ -137,5 +137,14 @@
138138 DEBUG("Constructed with text «%s» of length %d, flags %d", wikitext, wikitext_len, flags );
139139 preprocessed = preprocessToObj( wikitext, wikitext_len, flags, Z_ARRVAL_P(array), &preprocessed_len );
140140
 141+ if ( !preprocessed ) {
 142+ /* Preprocessing failed. The error code is given in preprocessed_len */
 143+ if ( preprocessed_len == 1 ) {
 144+ zend_throw_exception(zend_exception_get_default(), "Non-strings found in the parser strip list", 1 TSRMLS_CC);
 145+ } else {
 146+ zend_throw_exception(zend_exception_get_default(), "Unknown error preprocessing", 1 TSRMLS_CC);
 147+ }
 148+ }
 149+
141150 RETURN_STRINGL( preprocessed, preprocessed_len, 0 );
142151 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80461Follow up r80376. Added missing file FORMAT....platonides19:54, 17 January 2011

Status & tagging log