summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorGabriel Caruso <carusogabriel34@gmail.com>2018-07-26 21:12:21 -0300
committerGabriel Caruso <carusogabriel34@gmail.com>2018-08-28 21:20:00 -0300
commit2f7003847d3b48ea89fdec2bd5388085cf6b4d0e (patch)
treeeff844d0c3e0794916228369104fa3305a1cc0f7 /ext/curl
parent3748d8070ffd7750c73c327e212d6dc4fc76d427 (diff)
downloadphp-git-2f7003847d3b48ea89fdec2bd5388085cf6b4d0e.tar.gz
Make more tests run on Linux
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/tests/bug48203-win32.phpt37
-rw-r--r--ext/curl/tests/bug48203.phpt10
-rw-r--r--ext/curl/tests/bug54798-unix.phpt (renamed from ext/curl/tests/bug54798-win32.phpt)17
-rw-r--r--ext/curl/tests/bug54798.phpt16
-rw-r--r--ext/curl/tests/bug61948-unix.phpt23
-rw-r--r--ext/curl/tests/bug61948-win32.phpt32
-rw-r--r--ext/curl/tests/bug61948.phpt25
7 files changed, 58 insertions, 102 deletions
diff --git a/ext/curl/tests/bug48203-win32.phpt b/ext/curl/tests/bug48203-win32.phpt
deleted file mode 100644
index d3affdb71d..0000000000
--- a/ext/curl/tests/bug48203-win32.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
---SKIPIF--
-<?php include 'skipif.inc'; ?>
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip Windows only test');
-}
-?>
---FILE--
-<?php
-include 'server.inc';
-$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
-
-$ch = curl_init();
-
-curl_setopt($ch, CURLOPT_VERBOSE, 1);
-curl_setopt($ch, CURLOPT_STDERR, $fp);
-curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
-
-fclose($fp); // <-- premature close of $fp caused a crash!
-
-curl_exec($ch);
-curl_close($ch);
-
-echo "Ok\n";
-
-?>
---CLEAN--
-<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
---EXPECTF--
-Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
-%A
-Hello World!
-Hello World!* Closing connection 0
-Ok
-
diff --git a/ext/curl/tests/bug48203.phpt b/ext/curl/tests/bug48203.phpt
index fc8b4091fc..11855235c5 100644
--- a/ext/curl/tests/bug48203.phpt
+++ b/ext/curl/tests/bug48203.phpt
@@ -2,11 +2,6 @@
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
--SKIPIF--
<?php include 'skipif.inc'; ?>
-<?php
-if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- die('skip now for Windows');
-}
-?>
--FILE--
<?php
include 'server.inc';
@@ -29,6 +24,9 @@ echo "Ok\n";
--CLEAN--
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
--EXPECTF--
-Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203.php on line %d
+Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
%A
+Hello World!
+Hello World!* Closing connection 0
Ok
+
diff --git a/ext/curl/tests/bug54798-win32.phpt b/ext/curl/tests/bug54798-unix.phpt
index bce39903ba..d2542815d4 100644
--- a/ext/curl/tests/bug54798-win32.phpt
+++ b/ext/curl/tests/bug54798-unix.phpt
@@ -3,8 +3,8 @@ Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling c
--SKIPIF--
<?php
include 'skipif.inc';
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip Windows only');
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip not for Windows');
}
?>
--FILE--
@@ -56,12 +56,9 @@ foreach($options_to_check as $option) {
--CLEAN--
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
--EXPECTF--
-%AOk for CURLOPT_STDERR
-
-%AOk for CURLOPT_WRITEHEADER
-
-%AHello World!
-Hello World!Ok for CURLOPT_FILE
-
-%AOk for CURLOPT_INFILE
+%a
+%aOk for CURLOPT_STDERR
+%aOk for CURLOPT_WRITEHEADER
+%aOk for CURLOPT_FILE
+%aOk for CURLOPT_INFILE
===DONE===
diff --git a/ext/curl/tests/bug54798.phpt b/ext/curl/tests/bug54798.phpt
index d2542815d4..eab75e6fd4 100644
--- a/ext/curl/tests/bug54798.phpt
+++ b/ext/curl/tests/bug54798.phpt
@@ -3,9 +3,6 @@ Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling c
--SKIPIF--
<?php
include 'skipif.inc';
-if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- die('skip not for Windows');
-}
?>
--FILE--
<?php
@@ -56,9 +53,12 @@ foreach($options_to_check as $option) {
--CLEAN--
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
--EXPECTF--
-%a
-%aOk for CURLOPT_STDERR
-%aOk for CURLOPT_WRITEHEADER
-%aOk for CURLOPT_FILE
-%aOk for CURLOPT_INFILE
+%AOk for CURLOPT_STDERR
+
+%AOk for CURLOPT_WRITEHEADER
+
+%AHello World!
+Hello World!Ok for CURLOPT_FILE
+
+%AOk for CURLOPT_INFILE
===DONE===
diff --git a/ext/curl/tests/bug61948-unix.phpt b/ext/curl/tests/bug61948-unix.phpt
new file mode 100644
index 0000000000..cb84a466e7
--- /dev/null
+++ b/ext/curl/tests/bug61948-unix.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
+--SKIPIF--
+<?php if (!extension_loaded("curl")) print "skip";
+if(substr(PHP_OS, 0, 3) == 'WIN' )
+ die("skip Not Valid for Windows");
+?>
+--INI--
+open_basedir="/tmp"
+--FILE--
+<?php
+ $ch = curl_init();
+ var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
+ var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/foo"));
+ var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "/xxx/bar"));
+ curl_close($ch);
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+
+Warning: curl_setopt(): open_basedir restriction in effect. File(/xxx/bar) is not within the allowed path(s): (/tmp) in %sbug61948-unix.php on line %d
+bool(false)
diff --git a/ext/curl/tests/bug61948-win32.phpt b/ext/curl/tests/bug61948-win32.phpt
deleted file mode 100644
index b91ccb7815..0000000000
--- a/ext/curl/tests/bug61948-win32.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
---SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip";
-if(substr(PHP_OS, 0, 3) != 'WIN' )
- die("skip Not Valid for Linux");
-?>
---FILE--
-<?php
- $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
- mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
-
- ini_set("open_basedir", $base_dir);
-
- $ch = curl_init();
- var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
- var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo"));
- var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
- curl_close($ch);
-?>
---CLEAN--
-<?php
- $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
- rmdir("$base_dir/foo");
- rmdir($base_dir);
-?>
---EXPECTF--
-%a
-bool(true)
-
-Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (%sbug61948) in %sbug61948-win32.php on line %d
-bool(false)
diff --git a/ext/curl/tests/bug61948.phpt b/ext/curl/tests/bug61948.phpt
index 00df07d73e..b8fda6d83c 100644
--- a/ext/curl/tests/bug61948.phpt
+++ b/ext/curl/tests/bug61948.phpt
@@ -1,23 +1,30 @@
--TEST--
Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
--SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip";
-if(substr(PHP_OS, 0, 3) == 'WIN' )
- die("skip Not Valid for Windows");
+<?php if (!extension_loaded("curl")) print "skip curl extension not loaded";
?>
---INI--
-open_basedir="/tmp"
--FILE--
<?php
+ $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
+ mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
+
+ ini_set("open_basedir", $base_dir);
+
$ch = curl_init();
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
- var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/foo"));
- var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "/xxx/bar"));
+ var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo"));
+ var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
curl_close($ch);
?>
+--CLEAN--
+<?php
+ $base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
+ rmdir("$base_dir/foo");
+ rmdir($base_dir);
+?>
--EXPECTF--
-bool(true)
+%a
bool(true)
-Warning: curl_setopt(): open_basedir restriction in effect. File(/xxx/bar) is not within the allowed path(s): (/tmp) in %sbug61948.php on line %d
+Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (%sbug61948) in %sbug61948.php on line %d
bool(false)