[1]=>
string(7) "Heredoc"
[3]=>
- string(43) "heredoc string with!@# and 123
+ string(4%d) "heredoc string with!@# and 123
Test this!!!"
}
Done
echo "-- Iteration $i --\n";
$file_name = tempnam("$file_path", $names_arr[$i]);
- /* creating the files in existing dir */
- if( file_exists($file_name) ) {
- echo "File name is => ";
- print($file_name);
- echo "\n";
+ /* creating the files in existing dir */
+ if (file_exists($file_name) && !$res_arr[$i]) {
+ echo "Failed\n";
+ }
+ if ($res_arr[$i]) {
+ $file_dir = dirname($file_name);
+ if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) {
+ echo "OK\n";
+ } else {
+ echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n";
+ }
+
+ if (!is_writable($file_name)) {
+ printf("%o\n", fileperms($file_name) );
echo "File permissions are => ";
printf("%o", fileperms($file_name) );
File permissions are => 100666
File created in => directory specified
-- Iteration 5 --
-File name is => %s\%s
-File permissions are => 100666
-File created in => directory specified
+Failed, not created in the correct directory %s vs %s
+0
-- Iteration 6 --
File name is => %s\%s
File permissions are => 100666
Bug #49847 (exec() fails on lines larger then 4095 bytes)
--FILE--
<?php
-exec("printf %4098d 1", $output);
-var_dump($output);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(4098) " 1"
+$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);
}
---TEST--
-Bug #49847 (exec() fails on lines larger then 4095 bytes)
---FILE--
-<?php
-exec("printf %4098d 1", $output);
var_dump($output);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(4098) " 1"
+if ($iswin) {
+ unlink($f);
}
---TEST--
-Bug #49847 (exec() fails on lines larger then 4095 bytes)
---FILE--
-<?php
-exec("printf %4098d 1", $output);
-var_dump($output);
?>
---EXPECT--
+--EXPECTF--
array(1) {
[0]=>
- string(4098) " 1"
+ string(4098) "%s 1"
}
[0]=>
string(1) "x"
}
---TEST--
-Bug #50732 (exec() adds single byte twice to $output array)
---FILE--
-<?php
-exec("echo x", $output);
-var_dump($output);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(1) "x"
-}
---TEST--
-Bug #50732 (exec() adds single byte twice to $output array)
---FILE--
-<?php
-exec("echo x", $output);
-var_dump($output);
-?>
---EXPECT--
-array(1) {
- [0]=>
- string(1) "x"
-}
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
function getNice($id)
--TEST--
Test function proc_nice() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+ if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
?>
--FILE--
<?php
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
--FILE--
<?php
-- Iteration 54 --
string(4) "true"
-- Iteration 55 --
-string(54) "This is a multiline heredoc
+string(5%d) "This is a multiline heredoc
string. Numeric = 1232455."
-- Iteration 56 --
-string(10) "12345
+string(1%d) "12345
2345"
-- Iteration 57 --
string(0) ""
--TEST--
Bug #49936 (crash with ftp stream in php_stream_context_get_option())
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip. Do not run on Windows");
+?>
--FILE--
<?php
--- /dev/null
+--TEST--\r
+Bug #49936 (crash with ftp stream in php_stream_context_get_option())\r
+--SKIPIF--\r
+<?php\r
+if( substr(PHP_OS, 0, 3) != "WIN" )\r
+ die("skip. Do run on Windows only");\r
+?>\r
+--INI--\r
+default_socket_timeout=2\r
+--FILE--\r
+<?php\r
+\r
+$dir = 'ftp://your:self@localhost/';\r
+\r
+var_dump(opendir($dir));\r
+var_dump(opendir($dir));\r
+\r
+?>\r
+--EXPECTF--\r
+Warning: opendir(): connect() failed: %s\r
+ in %s on line %d\r
+\r
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d\r
+bool(false)\r
+\r
+Warning: opendir(): connect() failed: %s\r
+ in %s on line %d\r
+\r
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d\r
+bool(false)\r
Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d
NULL
bool(false)
-string(%d) "%s/test_path/file"
-string(%d) "%s/test_path/nested/file"
+string(%d) "%stest_path%sfile"
+string(%d) "%stest_path%snested%sfile"
return -1;
}
+#ifdef PHP_WIN32
+ if (!php_win32_check_trailing_space(pfx, (const int)strlen(pfx))) {
+ SetLastError(ERROR_INVALID_NAME);
+ return -1;
+ }
+#endif
+
if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
cwd[0] = '\0';
}
}
#ifdef PHP_WIN32
+
if (GetTempFileName(new_state.cwd, pfx, 0, opened_path)) {
/* Some versions of windows set the temp file to be read-only,
* which means that opening it will fail... */
VCWD_CHMOD(opened_path, 0600);
fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
}
+
#elif defined(HAVE_MKSTEMP)
fd = mkstemp(opened_path);
#else
fd = VCWD_OPEN(opened_path, open_flags);
}
#endif
+
if (fd == -1 || !opened_path_p) {
efree(opened_path);
} else {
#include "SAPI.h"
#include "php_streams_int.h"
+#ifdef PHP_WIN32
+# include "win32/winutil.h"
+#endif
#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC)
#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC)
return 0;
}
+#ifdef PHP_WIN32
+ if (!php_win32_check_trailing_space(url_from, strlen(url_from))) {
+ php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC);
+ return 0;
+ }
+ if (!php_win32_check_trailing_space(url_to, strlen(url_to))) {
+ php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to TSRMLS_CC);
+ return 0;
+ }
+#endif
+
if ((p = strstr(url_from, "://")) != NULL) {
url_from = p + 3;
}
static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC)
{
+#if PHP_WIN32
+ int url_len = strlen(url);
+#endif
if (PG(safe_mode) &&(!php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
return 0;
}
return 0;
}
+#if PHP_WIN32
+ if (!php_win32_check_trailing_space(url, url_len)) {
+ php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(ENOENT));
+ return 0;
+ }
+#endif
+
if (VCWD_RMDIR(url) < 0) {
php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno));
return 0;
return (buf ? (char *) buf : "");
}
+
+int php_win32_check_trailing_space(const char * path, const int path_len) {
+ if (path_len < 1) {
+ return 1;
+ }
+ if (path) {
+ if (path[0] == ' ' || path[path_len - 1] == ' ') {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ return 0;
+ }
+}
PHPAPI char *php_win_err(int error);
#define php_win_err() php_win_err(GetLastError())
+int php_win32_check_trailing_space(const char * path, const int path_len);