diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-16 10:13:02 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-16 10:13:02 +0100 |
commit | fd5a0b31640419ca63d1ddeaffd6d3cf2a741814 (patch) | |
tree | bfd17d84c5181d7b98d7d66f56573f4fc897e31c /ext/oci8/tests | |
parent | 01fcdff3849c3691d9aaeaab735846ab6d8895ca (diff) | |
download | php-fd5a0b31640419ca63d1ddeaffd6d3cf2a741814.tar.gz |
Imported Upstream version 5.3.5upstream/5.3.5
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r-- | ext/oci8/tests/bind_char_1.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bind_char_2.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bind_char_3.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bind_char_4.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bug27303_1.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bug27303_2.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/bug27303_4.phpt | 11 | ||||
-rw-r--r-- | ext/oci8/tests/connect_without_oracle_home.phpt | 4 | ||||
-rw-r--r-- | ext/oci8/tests/connect_without_oracle_home_11.phpt | 41 | ||||
-rw-r--r-- | ext/oci8/tests/connect_without_oracle_home_old.phpt | 4 | ||||
-rw-r--r-- | ext/oci8/tests/connect_without_oracle_home_old_11.phpt | 41 | ||||
-rw-r--r-- | ext/oci8/tests/debug.phpt | 56 | ||||
-rw-r--r-- | ext/oci8/tests/null_byte_1.phpt | 38 | ||||
-rw-r--r-- | ext/oci8/tests/null_byte_2.phpt | 69 | ||||
-rw-r--r-- | ext/oci8/tests/oci8safemode.phpt | 2 |
15 files changed, 259 insertions, 73 deletions
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index 71cccbfc5..24ab1fc82 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff on the undefined cases with a 32bit 11.2.0.1 DB - require(dirname(__FILE__).'/connect.inc'); // Initialization diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 6c7dbafcc..fa2e547db 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff on the undefined cases with a 32bit 11.2.0.1 DB - require(dirname(__FILE__).'/connect.inc'); // Initialization diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 8d4e95f6b..052981ace 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff on the undefined cases with a 32bit 11.2.0.1 DB - require(dirname(__FILE__).'/connect.inc'); // Initialization diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 40221b266..fd38d902c 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff on the undefined cases with a 32bit 11.2.0.1 DB - // Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR require(dirname(__FILE__).'/connect.inc'); diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt index 82c2d6f50..6d491966a 100644 --- a/ext/oci8/tests/bug27303_1.phpt +++ b/ext/oci8/tests/bug27303_1.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff with a 32bit 11.2.0.1 DB - require dirname(__FILE__).'/connect.inc'; $create_st = array(); diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 44b9ce6c6..3d0c08770 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff with a 32bit 11.2.0.1 DB - require dirname(__FILE__).'/connect.inc'; $create_st = array(); diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index 3c35c65b7..20dec54da 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -8,14 +8,19 @@ $sv = oci_server_version($c); $sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); +} else { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo); + if ($iv != 1) { + die ("skip test expected to work only with Oracle 11g or greater version of client"); + } } ?> --FILE-- <?php -// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. -// It will diff with a 32bit 11.2.0.1 DB - require dirname(__FILE__).'/connect.inc'; $create_st = array(); diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt index 42cbde8b4..e14fb9369 100644 --- a/ext/oci8/tests/connect_without_oracle_home.phpt +++ b/ext/oci8/tests/connect_without_oracle_home.phpt @@ -10,6 +10,10 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } +$iv = preg_match('/Oracle .*Version => (10\.2)/', $phpinfo); +if ($iv != 1) { + die ("skip tests a feature that works only with Oracle 10gR2"); +} ?> --ENV-- ORACLE_HOME="" diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt new file mode 100644 index 000000000..be99a8bd6 --- /dev/null +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -0,0 +1,41 @@ +--TEST-- +oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die("skip no oci8 extension"); +ob_start(); +phpinfo(INFO_MODULES); +$phpinfo = ob_get_clean(); +$ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); +if ($ov != 1) { + die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); +} +$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo); +if ($iv != 1) { + die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client"); +} +?> +--ENV-- +ORACLE_HOME="" +--FILE-- +<?php + +require dirname(__FILE__)."/details.inc"; + +if (!empty($dbase)) { + var_dump(oci_connect($user, $password, $dbase)); +} +else { + var_dump(oci_connect($user, $password)); +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d + +Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804 + in %s on line %d +bool(false) +===DONE=== diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt index 82d8ae451..602d55ff8 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt @@ -10,6 +10,10 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } +$iv = preg_match('/Oracle .*Version => (10\.2)/', $phpinfo); +if ($iv != 1) { + die ("skip tests a feature that works only with Oracle 10gR2"); +} ?> --ENV-- ORACLE_HOME="" diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt new file mode 100644 index 000000000..9bb42e75a --- /dev/null +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -0,0 +1,41 @@ +--TEST-- +ocilogon() without ORACLE_HOME set (OCIServerAttach() segfaults) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die("skip no oci8 extension"); +ob_start(); +phpinfo(INFO_MODULES); +$phpinfo = ob_get_clean(); +$ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); +if ($ov !== 1) { + die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); +} +$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo); +if ($iv != 1) { + die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client"); +} +?> +--ENV-- +ORACLE_HOME="" +--FILE-- +<?php + +require dirname(__FILE__)."/details.inc"; + +if (!empty($dbase)) { + var_dump(ocilogon($user, $password, $dbase)); +} +else { + var_dump(ocilogon($user, $password)); +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d + +Warning: ocilogon(): Error while trying to retrieve text for error ORA-01804 + in %sconnect_without_oracle_home_old_11.php on line %d +bool(false) +===DONE=== diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index 49e3d4cfd..fe96e6e87 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -1,16 +1,7 @@ --TEST-- oci_internal_debug() --SKIPIF-- -<?php -if (!extension_loaded('oci8')) die("skip no oci8 extension"); -ob_start(); -phpinfo(INFO_MODULES); -$phpinfo = ob_get_clean(); -$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo); -if ($iv !== 1) { - die ("skip expected output only valid when using Oracle 11gR2+ client libraries"); -} -?> +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> --FILE-- <?php @@ -27,45 +18,8 @@ else { echo "Done\n"; +oci_internal_debug(false); + ?> ---EXPECTF-- -OCI8 DEBUG: OCINlsEnvironmentVariableGet at (%s:%d) -OCI8 DEBUG L1: Got NO cached connection at (%s:%d) -OCI8 DEBUG: OCIEnvNlsCreate at (%s:%d) -OCI8 DEBUG: OCIHandleAlloc at (%s:%d) -OCI8 DEBUG: OCIHandleAlloc at (%s:%d) -OCI8 DEBUG: OCIHandleAlloc at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG: OCISessionPoolCreate at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG L1: create_spool: (%s:%d) -OCI8 DEBUG L1: using shared pool: (%s:%d) -OCI8 DEBUG: OCIHandleAlloc at (%s:%d) -OCI8 DEBUG: OCIHandleAlloc at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG: OCIAttrGet at (%s:%d) -OCI8 DEBUG: OCIAttrGet at (%s:%d) -OCI8 DEBUG L1: (numopen=0)(numbusy=0) at (%s:%d) -OCI8 DEBUG: OCISessionGet at (%s:%d) -OCI8 DEBUG: OCIAttrGet at (%s:%d) -OCI8 DEBUG: OCIAttrGet at (%s:%d) -OCI8 DEBUG: OCIContextGetValue at (%s:%d) -OCI8 DEBUG: OCIContextGetValue at (%s:%d) -OCI8 DEBUG: OCIMemoryAlloc at (%s:%d) -OCI8 DEBUG: OCIContextSetValue at (%s:%d) -OCI8 DEBUG: OCIAttrSet at (%s:%d) -OCI8 DEBUG L1: New Non-Persistent Connection address: (%s) at (%s:%d) -OCI8 DEBUG L1: num_persistent=(%s:%d) -OCI8 DEBUG: OCISessionRelease at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -Done -OCI8 DEBUG: OCISessionPoolDestroy at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) +--EXPECTREGEX-- +^OCI8 DEBUG: .*Done$ diff --git a/ext/oci8/tests/null_byte_1.phpt b/ext/oci8/tests/null_byte_1.phpt new file mode 100644 index 000000000..1439bd5d6 --- /dev/null +++ b/ext/oci8/tests/null_byte_1.phpt @@ -0,0 +1,38 @@ +--TEST-- +Protect against null bytes in LOB filenames (http://news.php.net/php.internals/50202) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +--INI-- +display_errors = On +error_reporting = E_WARNING +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Run Test + +echo "Test 1: Import\n"; + +$lob = oci_new_descriptor($c, OCI_D_LOB); +$r = $lob->savefile("/tmp/abc\0def"); +var_dump($r); + +echo "Test 2: Export\n"; + +$r = $lob->export("/tmp/abc\0def"); +var_dump($r); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1: Import + +Warning: OCI-Lob::savefile(): Filename cannot contain null bytes in %snull_byte_1.php on line %d +bool(false) +Test 2: Export + +Warning: OCI-Lob::export(): Filename cannot contain null bytes in %snull_byte_1.php on line %d +bool(false) +===DONE=== diff --git a/ext/oci8/tests/null_byte_2.phpt b/ext/oci8/tests/null_byte_2.phpt new file mode 100644 index 000000000..b4c9b61ad --- /dev/null +++ b/ext/oci8/tests/null_byte_2.phpt @@ -0,0 +1,69 @@ +--TEST-- +Null bytes in SQL statements +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +--INI-- +display_errors = On +error_reporting = E_WARNING +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Run Test + +echo "Test 1: Valid use of a null byte\n"; + +$s = oci_parse($c, "select * \0from dual"); +oci_execute($s); +oci_fetch_all($s, $res); +var_dump($res); + +echo "Test 2: Invalid use of a null byte\n"; + +$s = oci_parse($c, "select * from du\0al"); +oci_execute($s); + +echo "Test 3: Using a null byte in a bind variable name\n"; + +$s = oci_parse($c, "select * from dual where :bv = 1"); +$bv = 1; +oci_bind_by_name($s, ":bv\0:bv", $bv); +oci_execute($s); + +echo "Test 4: Using a null byte in a bind variable value causing WHERE clause to fail\n"; + +$s = oci_parse($c, "select * from dual where :bv = 'abc'"); +$bv = 'abc\0abc'; +oci_bind_by_name($s, ":bv", $bv); +oci_execute($s); +oci_fetch_all($s, $res); +var_dump($res); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1: Valid use of a null byte +array(1) { + ["DUMMY"]=> + array(1) { + [0]=> + string(1) "X" + } +} +Test 2: Invalid use of a null byte + +Warning: oci_execute(): ORA-00942: %s in %snull_byte_2.php on line %d +Test 3: Using a null byte in a bind variable name + +Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d + +Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d +Test 4: Using a null byte in a bind variable value causing WHERE clause to fail +array(1) { + ["DUMMY"]=> + array(0) { + } +} +===DONE=== diff --git a/ext/oci8/tests/oci8safemode.phpt b/ext/oci8/tests/oci8safemode.phpt index 1c62f36d3..02e180e65 100644 --- a/ext/oci8/tests/oci8safemode.phpt +++ b/ext/oci8/tests/oci8safemode.phpt @@ -15,7 +15,7 @@ $r = oci_password_change($c, "hr", "hrpwd", "hrpwd"); echo "Done\n"; ?> --EXPECTF-- -%sarning:%sDirective 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0 +%s: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0 Warning: oci_connect(): Privileged connect is disabled in Safe Mode in %s on line %d |