[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added, and revision status changed
Awjrichards changed the status of MediaWiki.r113688 to fixme and commented it. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32252 Old Status: new New Status: fixme Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Awjrichards's comment: Brion is right. What were you doing that was causing failure? Were you using a $wgPhpCli with a space in it that you'd already quoted? :p ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Aaron Schulz posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32255 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Aaron Schulz's comment: Passing 'php path/to/script.php' (all ascii chars, no spaces) to proc_open() results in failure. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Awjrichards posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32257 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Awjrichards's comment: Yeesh. 'php path/to/script.php' is a totally legitimate command to run in bash, but I have no idea about other environments (like WIndows). This sounds like a problem (bug?) with proc_open(). Do you see the same behavior with other PHP functions that take $cmd as an argument? I wonder if proc_open() is also escaping $cmd resulting in nasty double escaped-ness. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Aaron Schulz posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32260 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Aaron Schulz's comment: I was messing around with this some more. shell_exec seems to work fine without or without the quotes. the popen() type functions are more interesting. I tried: source lang=php ?php #$r = popen( 'php C:\wamp\www\MW_trunk/maintenance/showStats.php', 'r' ); #var_dump( stream_get_contents( $r ) ); $pipes = array(); $process = proc_open( 'php C:\wamp\www\MW_trunk/maintenance/showStats.php', #'php C:\wamp\www\MW_trunk/maintenance/showStats.php', array( 0 = array( 'pipe', 'r' ), // input 1 = array( 'pipe', 'w' ), // output 2 = array( 'file', 'NUL', 'a' ) // error ), $pipes // respective outputs ); fclose( $pipes[0] ); var_dump( stream_get_contents( $pipes[1] ) ); fclose( $pipes[1] ); proc_close($process); /source popen seems to work in either case. proc_open() also works without the quotes: pre Aaron@AARON-PC-GAME /c/wamp/www/MW_trunk $ php shelltest.php string(162) Total views :654 Total edits : 194712 Number of articles: 4900 Total pages : 16430 Number of users : 8 Number of images : 46 /pre However, proc_open() gives an empty response when I have the extra quotes pre Aaron@AARON-PC-GAME /c/wamp/www/MW_trunk $ php shelltest.php string(0) /pre ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Aaron Schulz posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32261 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Aaron Schulz's comment: OK, wtf...If I set the bypass cmd.exe flag it works again. See: source lang=php $process = proc_open( 'php C:\wamp\www\MW_trunk/maintenance/showStats.php', #'php C:\wamp\www\MW_trunk/maintenance/showStats.php', array( 0 = array( 'pipe', 'r' ), // input 1 = array( 'pipe', 'w' ), // output 2 = array( 'file', 'NUL', 'a' ) // error ), $pipes, // respective outputs null, null, array( 'bypass_shell' = true ) ); /source ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Brion VIBBER posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32124 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Brion VIBBER's comment: Offhand that doesn't look excess to me; if $wgPhpCli is in a directory with a space for instance, you need to be quoting that. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Aaron Schulz posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32125 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Aaron Schulz's comment: I'm kind of assuming the variable would be set to deal with that. If it is escaped, it needs to be done correctly. I wasted some good time trying to use this function and figure out why the shell call kept failing. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113688]: New comment added
Brion VIBBER posted a comment on MediaWiki.r113688. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113688#c32126 Commit summary for MediaWiki.r113688: Made wfShellMaintenanceCmd() not totally broken due to excess shell escaping. Brion VIBBER's comment: The variable should probably not assume that it's pre-escaped; other paths are not. Why's it failing for you? ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview