summaryrefslogtreecommitdiffhomepage
path: root/test/php
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2020-03-03 18:53:26 +0000
committerTiago Natel de Moura <t.nateldemoura@f5.com>2020-03-03 18:53:26 +0000
commit80763b3e64cfeae358c521fa563cc9eaa48f4ea2 (patch)
tree7d0ae8068c5eddbfcbf52c7998677db0e8b5de27 /test/php
parent293b0da5201917dcecc09340e8e33eaff954b326 (diff)
downloadunit-80763b3e64cfeae358c521fa563cc9eaa48f4ea2.tar.gz
unit-80763b3e64cfeae358c521fa563cc9eaa48f4ea2.tar.bz2
Tests: chdir() and open() for PHP module.
These tests ensure optimizations in the chdir calls don't break SAPI semantics.
Diffstat (limited to 'test/php')
-rw-r--r--test/php/cwd/index.php19
-rw-r--r--test/php/cwd/subdir/index.php1
-rw-r--r--test/php/open/index.php7
-rw-r--r--test/php/open/test.txt1
4 files changed, 28 insertions, 0 deletions
diff --git a/test/php/cwd/index.php b/test/php/cwd/index.php
new file mode 100644
index 00000000..24ae3a21
--- /dev/null
+++ b/test/php/cwd/index.php
@@ -0,0 +1,19 @@
+<?php
+
+if (isset($_GET['chdir']) && $_GET['chdir'] != "") {
+ if (!chdir($_GET['chdir'])) {
+ echo "failure to chdir(" . $_GET['chdir'] . ")\n";
+ exit;
+ }
+}
+
+$opcache = -1;
+
+if (function_exists('opcache_get_status')) {
+ $opcache = opcache_get_status()->opcache_enabled;
+}
+
+header('X-OPcache: ' . $opcache);
+
+print(getcwd());
+?>
diff --git a/test/php/cwd/subdir/index.php b/test/php/cwd/subdir/index.php
new file mode 100644
index 00000000..597bcac4
--- /dev/null
+++ b/test/php/cwd/subdir/index.php
@@ -0,0 +1 @@
+<?php print(getcwd()); ?>
diff --git a/test/php/open/index.php b/test/php/open/index.php
new file mode 100644
index 00000000..a5bebc54
--- /dev/null
+++ b/test/php/open/index.php
@@ -0,0 +1,7 @@
+<?php
+if (isset($_GET['chdir'])) {
+ chdir($_GET['chdir']);
+}
+
+echo file_get_contents('test.txt');
+?>
diff --git a/test/php/open/test.txt b/test/php/open/test.txt
new file mode 100644
index 00000000..30d74d25
--- /dev/null
+++ b/test/php/open/test.txt
@@ -0,0 +1 @@
+test \ No newline at end of file