r72238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72237‎ | r72238 | r72239 >
Date:22:15, 2 September 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Add some $retval = '' before some wfShellExec
Modified paths:
  • /trunk/phase3/includes/DjVuImage.php (modified) (history)
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)
  • /trunk/phase3/includes/media/DjVu.php (modified) (history)
  • /trunk/phase3/includes/media/SVG.php (modified) (history)
  • /trunk/phase3/includes/parser/LinkHolderArray.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOptions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/LinkHolderArray.php
@@ -345,7 +345,9 @@
346346 extract( $titlesAttrs[$i] );
347347 if($textVariant != $titleText){
348348 $variantTitle = Title::makeTitle( $ns, $textVariant );
349 - if( is_null( $variantTitle ) ) { continue; }
 349+ if( is_null( $variantTitle ) ) {
 350+ continue;
 351+ }
350352 $linkBatch->addObj( $variantTitle );
351353 $variantMap[$variantTitle->getPrefixedDBkey()][] = $key;
352354 }
Index: trunk/phase3/includes/parser/ParserOptions.php
@@ -38,6 +38,7 @@
3939 var $mMath; # User math preference (as integer)
4040 var $mUserLang; # Language code of the User language.
4141 var $mThumbSize; # Thumb size preferred by the user.
 42+ var $mCleanSignatures; #
4243
4344 var $mUser; # Stored user object, just used to initialise the skin
4445 var $mIsPreview; # Parsing the page for a "preview" operation
@@ -134,7 +135,7 @@
135136 function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); }
136137 function setMath( $x ) { return wfSetVar( $this->mMath, $x ); }
137138 function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); }
138 - function setThumbSize() { return wfSetVar( $this->mThumbSize, $x ); }
 139+ function setThumbSize( $x ) { return wfSetVar( $this->mThumbSize, $x ); }
139140
140141 function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
141142 function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
Index: trunk/phase3/includes/media/Bitmap.php
@@ -362,7 +362,8 @@
363363 global $wgImageMagickConvertCommand;
364364 $cmd = wfEscapeShellArg( $wgImageMagickConvertCommand ) . ' -version';
365365 wfDebug( __METHOD__.": Running convert -version\n" );
366 - $return = wfShellExec( $cmd, $retval );
 366+ $retval = '';
 367+ $return = wfShellExec( $cmd, &$retval );
367368 $x = preg_match('/Version: ImageMagick ([0-9]*\.[0-9]*\.[0-9]*)/', $return, $matches);
368369 if( $x != 1 ) {
369370 wfDebug( __METHOD__.": ImageMagick version check failed\n" );
Index: trunk/phase3/includes/media/SVG.php
@@ -82,6 +82,7 @@
8383 public function rasterize( $srcPath, $dstPath, $width, $height ) {
8484 global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath;
8585 $err = false;
 86+ $retval = '';
8687 if ( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
8788 $cmd = str_replace(
8889 array( '$path/', '$width', '$height', '$input', '$output' ),
@@ -94,7 +95,7 @@
9596 ) . " 2>&1";
9697 wfProfileIn( 'rsvg' );
9798 wfDebug( __METHOD__.": $cmd\n" );
98 - $err = wfShellExec( $cmd, $retval );
 99+ $err = wfShellExec( $cmd, &$retval );
99100 wfProfileOut( 'rsvg' );
100101 }
101102 $removed = $this->removeBadFile( $dstPath, $retval );
Index: trunk/phase3/includes/media/DjVu.php
@@ -108,7 +108,8 @@
109109 $cmd .= ' > ' . wfEscapeShellArg($dstPath) . ') 2>&1';
110110 wfProfileIn( 'ddjvu' );
111111 wfDebug( __METHOD__.": $cmd\n" );
112 - $err = wfShellExec( $cmd, $retval );
 112+ $retval = '';
 113+ $err = wfShellExec( $cmd, &$retval );
113114 wfProfileOut( 'ddjvu' );
114115
115116 $removed = $this->removeBadFile( $dstPath, $retval );
Index: trunk/phase3/includes/DjVuImage.php
@@ -248,7 +248,8 @@
249249 wfProfileIn( 'djvutxt' );
250250 $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ) ;
251251 wfDebug( __METHOD__.": $cmd\n" );
252 - $txt = wfShellExec( $cmd, $retval );
 252+ $retval = '';
 253+ $txt = wfShellExec( $cmd, &$retval );
253254 wfProfileOut( 'djvutxt' );
254255 if( $retval == 0) {
255256 # Get rid of invalid UTF-8, strip control characters

Follow-up revisions

RevisionCommit summaryAuthorDate
r72290Followup r72238, remove &reedy16:00, 3 September 2010

Comments

#Comment by Platonides (talk | contribs)   22:31, 2 September 2010

I assume this is an error...

-	function setThumbSize()                     { return wfSetVar( $this->mThumbSize, $x ); }
+	function setThumbSize( $x )                 { return wfSetVar( $this->mThumbSize, $x ); }
#Comment by Reedy (talk | contribs)   22:37, 2 September 2010

Just missed from the commit summary

$x is used on the right hand side, as seen

#Comment by Platonides (talk | contribs)   23:07, 2 September 2010

Oh, sorry. I thought you were removing the parameter.

Oked.

#Comment by Nikerabbit (talk | contribs)   06:34, 3 September 2010

Isn't call time "&" deprecated?

#Comment by Platonides (talk | contribs)   13:48, 3 September 2010

It is:

PHP Deprecated:  Call-time pass-by-reference has been deprecated in trunk/phase3/includes/media/Bitmap.php on line 366

I thought that only call time & when the prototype doesn't have it was.

#Comment by Reedy (talk | contribs)   15:54, 3 September 2010

What do we do about the definition?

function wfShellExec( $cmd, &$retval = null ) {

Can we just leave that as is?

#Comment by Platonides (talk | contribs)   18:27, 3 September 2010

?

Yes, the definition is right.

Status & tagging log