xref: /PHP-7.2/ext/oci8/tests/null_byte_1.phpt (revision af482a4f)
1--TEST--
2Protect against null bytes in LOB filenames
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8'))
6    die ("skip no oci8 extension");
7if (PHP_MAJOR_VERSION < 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4))
8    die ("skip Test only valid for PHP 5.4 onwards");
9?>
10--INI--
11display_errors = On
12error_reporting = E_WARNING
13--FILE--
14<?php
15
16// See http://news.php.net/php.internals/50202
17//     http://svn.php.net/viewvc?view=revision&revision=311870
18
19require(dirname(__FILE__).'/connect.inc');
20
21// Run Test
22
23echo "Test 1: Import\n";
24
25$lob = oci_new_descriptor($c, OCI_D_LOB);
26$r = $lob->savefile("/tmp/abc\0def");
27var_dump($r);
28
29echo "Test 2: Export\n";
30
31$r = $lob->export("/tmp/abc\0def");
32var_dump($r);
33
34?>
35===DONE===
36<?php exit(0); ?>
37--EXPECTF--
38Test 1: Import
39
40Warning: OCI-Lob::savefile() expects parameter 1 to be a valid path, string given in %snull_byte_1.php on line %d
41NULL
42Test 2: Export
43
44Warning: OCI-Lob::export() expects parameter 1 to be a valid path, string given in %snull_byte_1.php on line %d
45NULL
46===DONE===
47