r12503 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12502‎ | r12503 | r12504 >
Date:10:29, 8 January 2006
Author:avar
Status:old
Tags:
Comment:
* Using var_dump() with output buffering instead of print_r(), allows for
distinguishing between an empty string and NULL
* Formatting
* Documentation: @copyright...
Modified paths:
  • /trunk/phase3/maintenance/parserTestsParserHook.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTestsParserHook.php
@@ -1,5 +1,6 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die();
 3+if ( ! defined( 'MEDIAWIKI' ) )
 4+ die();
45 /**
56 * A basic extension that's used by the parser tests to test whether input and
67 * arguments are passed to extensions properly.
@@ -8,6 +9,7 @@
910 * @subpackage Maintenance
1011 *
1112 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
 13+ * @copyright Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason
1214 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1315 */
1416
@@ -18,8 +20,12 @@
1921 }
2022
2123 function wfParserTestHook( $in, $argv ) {
22 - if ( count( $argv ) )
23 - return "<pre>\n" . print_r( $argv, true ) . '</pre>';
24 - else
25 - return $in;
 24+ ob_start();
 25+ var_dump(
 26+ $in,
 27+ $argv
 28+ );
 29+ $ret = ob_get_clean();
 30+
 31+ return "<pre>\n$ret</pre>";
2632 }

Status & tagging log