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