]> granicus.if.org Git - php/commitdiff
- make it work on win, simplify expect using expectf
authorPierre Joye <pajoye@php.net>
Mon, 25 Jan 2010 13:49:47 +0000 (13:49 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 25 Jan 2010 13:49:47 +0000 (13:49 +0000)
ext/standard/tests/general_functions/bug49847.phpt

index 01ee1618c0efab5d8f28106489f4fc233d400b95..8895202d0cbf3e2c384500bd9b87af3970cc6c6a 100644 (file)
@@ -2,11 +2,24 @@
 Bug #49847 (exec() fails on lines larger then 4095 bytes)
 --FILE--
 <?php
-exec("printf %4098d 1", $output);
+$iswin =  substr(PHP_OS, 0, 3) == "WIN";
+
+if ($iswin) {
+       $f = dirname(__FILE__) . '\\bug49847.tmp';
+       $s = str_repeat(' ', 4097);
+       $s .= '1';
+       file_put_contents($f, $s);
+       exec('more ' . $f, $output);
+} else {
+       exec("printf %4098d 1", $output);
+}
 var_dump($output);
+if ($iswin) {
+       unlink($f);
+}
 ?>
---EXPECT--
+--EXPECTF--
 array(1) {
   [0]=>
-  string(4098) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1"
+  string(4098) "%s 1"
 }