. Improved IS_VAR operands fetching. (Laruence, Dmitry)
. Implemented internal operator overloading
(RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita)
+ . Enabled file uploads greater than 2G (Ralf Lang, Mike)
- mysqlnd:
. Disabled flag for SP OUT variables for 5.5+ servers as they are not natively
define ("PHP_CLI_SERVER_PORT", 8964);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
-function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
+function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, $cmd_args = null) {
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$router = "index.php";
);
if (substr(PHP_OS, 0, 3) == 'WIN') {
- $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS;
+ $cmd = "{$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS;
if (!$no_router) {
$cmd .= " {$router}";
}
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
} else {
- $cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS;
+ $cmd = "exec {$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS;
if (!$no_router) {
$cmd .= " {$router}";
}
--- /dev/null
+--TEST--
+file upload greater than 2G
+--SKIPIF--
+<?php
+include "skipif.inc";
+
+if (PHP_INT_SIZE < 8) {
+ die("skip need PHP_INT_SIZE>=8");
+}
+
+if ($f = fopen("/proc/meminfo","r")) {
+ while (!feof($f)) {
+ if (!strncmp($line = fgets($f), "MemFree", 7)) {
+ if (substr($line,8)/1024/1024 > 3) {
+ $enough_free_ram = true;
+ }
+ }
+ }
+}
+
+if (empty($enough_free_ram)) {
+ die("need +3G free RAM");
+}
+?>
+--FILE--
+<?php
+
+echo "Test\n";
+
+include "php_cli_server.inc";
+
+php_cli_server_start("var_dump(\$_FILES);", false,
+ "-d post_max_size=3G -d upload_max_filesize=3G");
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+$length = 2150000000;
+$output = "";
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+ die("connect failed");
+}
+
+$prev = "----123
+Content-Type: text/plain
+Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n";
+$post = "\n----123--\n";
+$total = $length + strlen($prev) + strlen($post);
+
+fwrite($fp, <<<EOF
+POST /index.php HTTP/1.1
+Host: {$host}
+Content-Type: multipart/form-data; boundary=--123
+Content-Length: {$total}
+
+{$prev}
+EOF
+) or die("write prev failed");
+
+$data = str_repeat("0123456789", 10000);
+for ($i = 0; $i < $length; $i += 10000 * 10) {
+ fwrite($fp, $data) or die("write failed @ ($i)");
+}
+
+fwrite($fp, $post) or die("write post failed");
+
+while (!feof($fp)) {
+ $output .= fgets($fp);
+}
+echo $output;
+fclose($fp);
+?>
+Done
+--EXPECTF--
+Test
+
+HTTP/1.1 200 OK
+Host: %s
+Connection: close
+X-Powered-By: PHP/%s
+Content-type: text/html
+
+array(1) {
+ ["file1"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file1.txt"
+ ["type"]=>
+ string(10) "text/plain"
+ ["tmp_name"]=>
+ string(14) "/tmp/php%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(2150000000)
+ }
+}
+Done