xref: /PHP-8.1/ext/oci8/tests/bug38161.phpt (revision 74859783)
1--TEST--
2Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
3--EXTENSIONS--
4oci8
5--FILE--
6<?php
7
8require __DIR__.'/connect.inc';
9
10$query = "begin if false then :bv := 1; end if; end;";
11$stid = oci_parse($c, $query);
12oci_bind_by_name($stid, ":bv", $bv, 22);
13oci_execute($stid, OCI_DEFAULT);
14
15var_dump($bv);
16unset($bv);
17
18$query = "begin if false then :bv := 1; end if; end;";
19$stid = oci_parse($c, $query);
20oci_bind_by_name($stid, ":bv", $bv, 22, SQLT_INT);
21oci_execute($stid, OCI_DEFAULT);
22
23var_dump($bv);
24
25echo "Done\n";
26?>
27--EXPECT--
28NULL
29int(0)
30Done
31