Skip to content

Made some OCI8 tests compatible with PHP 8. #5716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ext/oci8/tests/bug51291_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ echo "\nTest 2 - Parse\n";

$s = @oci_parse($c, "select ' from dual");
if (!$s) {
var_dump(oci_error(), oci_error($c), oci_error($s));
var_dump(oci_error(), oci_error($c));
echo "2nd call\n";
var_dump(oci_error(), oci_error($c), oci_error($s));
var_dump(oci_error(), oci_error($c));
}

echo "\nTest 3 - Execute\n";
Expand Down Expand Up @@ -164,8 +164,6 @@ array(4) {
}

Test 2 - Parse

Warning: oci_error(): Argument #1 must be of type resource, bool%sgiven in %sbug51291_1.php on line %d
bool(false)
array(4) {
["code"]=>
Expand All @@ -177,10 +175,7 @@ array(4) {
["sqltext"]=>
string(0) ""
}
NULL
2nd call

Warning: oci_error(): Argument #1 must be of type resource, bool%sgiven in %sbug51291_1.php on line %d
bool(false)
array(4) {
["code"]=>
Expand All @@ -192,7 +187,6 @@ array(4) {
["sqltext"]=>
string(0) ""
}
NULL

Test 3 - Execute
array(4) {
Expand Down
11 changes: 7 additions & 4 deletions ext/oci8/tests/coll_002_func.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ require __DIR__."/create_type.inc";
var_dump($coll1 = oci_new_collection($c, $type_name));

var_dump(oci_free_collection($coll1));
var_dump(oci_collection_size($coll1));

try {
var_dump(oci_collection_size($coll1));
} catch(\TypeError $exception) {
var_dump($exception->getMessage());
}

echo "Done\n";

Expand All @@ -27,7 +32,5 @@ object(OCI-Collection)#%d (1) {
resource(%d) of type (oci8 collection)
}
bool(true)

Warning: oci_collection_size(): supplied resource is not a valid oci8 collection resource in %s on line %d
bool(false)
string(%d) "oci_collection_size(): supplied resource is not a valid oci8 collection resource"
Done
8 changes: 0 additions & 8 deletions ext/oci8/tests/coll_018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ require __DIR__."/create_type.inc";

$coll1 = oci_new_collection($c, $type_name);

echo "Test 1.\n";
var_dump($coll1->trim());

echo "\nTest 2.\n";
var_dump($coll1->trim(0));

Expand Down Expand Up @@ -56,11 +53,6 @@ require __DIR__."/drop_type.inc";

?>
--EXPECTF--
Test 1.

Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
NULL

Test 2.
bool(true)

Expand Down
4 changes: 0 additions & 4 deletions ext/oci8/tests/define1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ $string = '';
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "", $string, 20));
var_dump(oci_define_by_name($stmt, ""));

oci_execute($stmt);

Expand All @@ -52,8 +51,5 @@ bool(false)

Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
bool(false)

Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
NULL
string(4) "some"
Done
10 changes: 6 additions & 4 deletions ext/oci8/tests/define4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ while (oci_fetch($stmt)) {
echo "Test 3\n";
var_dump(oci_free_statement($stmt));
var_dump($string);
var_dump(oci_result($stmt, 'STRING'));

try {
var_dump(oci_result($stmt, 'STRING'));
} catch(\TypeError $exception) {
var_dump($exception->getMessage());
}
// Cleanup

$stmtarray = array(
Expand All @@ -67,7 +71,5 @@ string(4) "some"
Test 3
bool(true)
string(4) "some"

Warning: oci_result(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
string(%d) "oci_result(): supplied resource is not a valid oci8 statement resource"
Done
2 changes: 1 addition & 1 deletion ext/oci8/tests/fetch_object_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (!oci_execute($s)) {

while ($row = oci_fetch_object($s)) {
echo $row->COL1 . "\n";
echo $row->COL2->load(100) . "\n";
echo $row->COL2->load() . "\n";
echo $row->COL3 . "\n";
}

Expand Down
37 changes: 0 additions & 37 deletions ext/oci8/tests/field_funcs1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ var_dump(oci_field_scale($s, "none"));
var_dump(oci_field_precision($s, "none"));
var_dump(oci_field_size($s, "none"));

echo "Test 3\n";
var_dump(oci_field_is_null($c, -1));
var_dump(oci_field_name($c, -1));
var_dump(oci_field_type($c, -1));
var_dump(oci_field_type_raw($c, -1));
var_dump(oci_field_scale($c, -1));
var_dump(oci_field_precision($c, -1));
var_dump(oci_field_size($c, -1));

echo "Test 4\n";
var_dump(oci_field_is_null($s, array()));
var_dump(oci_field_name($s, array()));
Expand All @@ -68,9 +59,6 @@ var_dump(oci_field_scale($s, array()));
var_dump(oci_field_precision($s, array()));
var_dump(oci_field_size($s, array()));

var_dump(oci_field_size($s));


// Cleanup

$stmtarray = array(
Expand Down Expand Up @@ -133,28 +121,6 @@ bool(false)

Warning: oci_field_size(): Invalid column name "none" in %s on line %d
bool(false)
Test 3

Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)

Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
Test 4

Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
Expand All @@ -177,7 +143,4 @@ bool(false)

Warning: oci_field_size(): Invalid column index "0" in %s on line %d
bool(false)

Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
bool(false)
Done
18 changes: 11 additions & 7 deletions ext/oci8/tests/imp_res_close.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ oci8_test_sql_execute($c, $stmtarray);
echo "Test 1\n";
$s = oci_parse($c, "begin imp_res_close_proc(); end;");
oci_execute($s);
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;

try {
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;
}
echo "\n";
oci_free_statement($s); // Free the implicit result handle
}
echo "\n";
oci_free_statement($s); // Free the implicit result handle
} catch(\TypeError $exception) {
var_dump($exception->getMessage());
}

// Clean up
Expand All @@ -61,5 +66,4 @@ oci8_test_sql_execute($c, $stmtarray);
--EXPECTF--
Test 1
1

Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %simp_res_close.php on line %d
string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource"
27 changes: 12 additions & 15 deletions ext/oci8/tests/imp_res_get_close_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,23 @@ echo "Test 1\n";
$s = oci_parse($c, $plsql);
oci_execute($s);

while (($s1 = oci_get_implicit_resultset($s))) {
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;
try {
while (($s1 = oci_get_implicit_resultset($s))) {
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;
}
echo "\n";
oci_free_statement($s1); // Free the implicit result handle
}
echo "\n";
oci_free_statement($s1); // Free the implicit result handle
}
oci_free_statement($s);
} catch(\TypeError $exception) {
var_dump($exception->getMessage());
}
oci_free_statement($s);

?>
--EXPECTF--
Test 1
1

Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
3

Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
5

Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource"
19 changes: 11 additions & 8 deletions ext/oci8/tests/imp_res_get_close_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ echo "Test 1\n";
$s = oci_parse($c, $plsql);
oci_execute($s);

while (($s1 = oci_get_implicit_resultset($s))) {
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;
try {
while (($s1 = oci_get_implicit_resultset($s))) {
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
foreach ($row as $item) {
echo " ".$item;
}
echo "\n";
oci_free_statement($s); // close parent
}
echo "\n";
oci_free_statement($s); // close parent
}
} catch(\TypeError $exception) {
var_dump($exception->getMessage());
}

?>
Expand All @@ -56,5 +60,4 @@ Test 1
1

Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d

Warning: oci_get_implicit_resultset(): supplied resource is not a valid oci8 statement resource in %s on line %d
string(%d) "oci_get_implicit_resultset(): supplied resource is not a valid oci8 statement resource"
8 changes: 0 additions & 8 deletions ext/oci8/tests/lob_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ oci_execute($statement, OCI_DEFAULT);
var_dump($blob);

var_dump($blob->write("test", -1));
var_dump($blob->write("test", "str"));
var_dump($blob->write("test", 1000000));
var_dump($blob->write(str_repeat("test", 10000), 1000000));
var_dump($blob->tell());
var_dump($blob->seek("str", -5));
var_dump($blob->flush());

oci_commit($c);
Expand Down Expand Up @@ -59,14 +57,8 @@ object(OCI-Lob)#%d (1) {
resource(%d) of type (oci8 descriptor)
}
int(0)

Warning: OCI-Lob::write(): Argument #2 must be of type int%s string given in %slob_002.php on line %d
NULL
int(4)
int(40000)
int(40004)

Warning: OCI-Lob::seek(): Argument #1 must be of type int%s string given in %slob_002.php on line %d
NULL
bool(false)
int(40004)
4 changes: 0 additions & 4 deletions ext/oci8/tests/lob_014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var_dump($blob->write("test"));
var_dump($blob->close());
var_dump($blob->write("test"));
var_dump($blob->free());
var_dump($blob->write("test"));

oci_commit($c);

Expand All @@ -49,9 +48,6 @@ int(4)
bool(true)
int(4)
bool(true)

Warning: OCI-Lob::write(): %s is not a valid oci8 descriptor resource in %slob_014.php on line %d
bool(false)
array(1) {
[0]=>
string(8) "testtest"
Expand Down
54 changes: 0 additions & 54 deletions ext/oci8/tests/lob_015.phpt

This file was deleted.

Binary file modified ext/oci8/tests/lob_020.phpt
Binary file not shown.
Loading