diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-03-09 11:57:54 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-03-09 11:57:54 +0100 |
| commit | 855a09f4eded707941180c9d90acd17c25e29447 (patch) | |
| tree | a40947efaa9876f31b6ee3956c3f3775768143bb /ext/standard/tests/streams | |
| parent | c852c28a88fccf6e34a2cb091fdfa72bce2b59c7 (diff) | |
| download | php-855a09f4eded707941180c9d90acd17c25e29447.tar.gz | |
Imported Upstream version 5.3.2upstream/5.3.2
Diffstat (limited to 'ext/standard/tests/streams')
| -rw-r--r-- | ext/standard/tests/streams/bug49936.phpt | 26 | ||||
| -rw-r--r-- | ext/standard/tests/streams/bug49936_win32.phpt | 30 | ||||
| -rw-r--r-- | ext/standard/tests/streams/stream_resolve_include_path.phpt | 37 |
3 files changed, 93 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/bug49936.phpt b/ext/standard/tests/streams/bug49936.phpt new file mode 100644 index 000000000..d77e161c5 --- /dev/null +++ b/ext/standard/tests/streams/bug49936.phpt @@ -0,0 +1,26 @@ +--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 + +$dir = 'ftp://your:self@localhost/'; + +var_dump(opendir($dir)); +var_dump(opendir($dir)); + +?> +--EXPECTF-- +Warning: opendir(): connect() failed: Connection refused in %s on line %d + +Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d +bool(false) + +Warning: opendir(): connect() failed: Connection refused in %s on line %d + +Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d +bool(false) diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt new file mode 100644 index 000000000..4db4a5044 --- /dev/null +++ b/ext/standard/tests/streams/bug49936_win32.phpt @@ -0,0 +1,30 @@ +--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 run on Windows only");
+?>
+--INI--
+default_socket_timeout=2
+--FILE--
+<?php
+
+$dir = 'ftp://your:self@localhost/';
+
+var_dump(opendir($dir));
+var_dump(opendir($dir));
+
+?>
+--EXPECTF--
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
+
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt new file mode 100644 index 000000000..aea5cdd96 --- /dev/null +++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt @@ -0,0 +1,37 @@ +--TEST-- +stream_resolve_include_path(string path) +--FILE-- +<?php +$include_path = __DIR__ . '/test_path'; +$include_path_nested = $include_path . '/nested'; + +$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file'; +$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file'; + +mkdir($include_path); +mkdir($include_path_nested); + +file_put_contents($include_path_file, 'include_path'); +file_put_contents($include_path_nested_file, 'include_path'); + +var_dump(stream_resolve_include_path()); + +set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); +var_dump(stream_resolve_include_path('file-does-not-exist')); + +set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); +var_dump(stream_resolve_include_path('file')); +set_include_path($include_path_nested . PATH_SEPARATOR . $include_path); +var_dump(stream_resolve_include_path('file')); + +unlink($include_path_nested_file); +rmdir($include_path_nested); +unlink($include_path_file); +rmdir($include_path); +--EXPECTF-- +Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d +NULL +bool(false) +string(%d) "%stest_path%sfile" +string(%d) "%stest_path%snested%sfile" + |
