PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/oci8/tests/bug51253.phpt ('Bug #51253 (oci_bind_array_by_name() array references)')

Script

1: <?php
2:
3:
require(dirname(__FILE__).'/connect.inc');
4:
5:
$drop "DROP table bind_test";
6:
$statement oci_parse($c$drop);
7: @
oci_execute($statement);
8:
9:
$create "CREATE table bind_test(name VARCHAR(20))";
10:
$statement oci_parse($c$create);
11:
oci_execute($statement);
12:
13:
$create_pkg "
14: CREATE OR REPLACE PACKAGE BUG51253_PKG AS 
15:   TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; 
16:   PROCEDURE iobind(c1 IN OUT ARRTYPE); 
17: END BUG51253_PKG;"
;
18:
$statement oci_parse($c$create_pkg);
19:
oci_execute($statement);
20:
21:
$create_pkg_body "
22: CREATE OR REPLACE PACKAGE BODY BUG51253_PKG AS 
23:   CURSOR CUR IS SELECT name FROM bind_test;
24:   PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
25:     BEGIN
26:     FOR i IN 1..5 LOOP
27:       INSERT INTO bind_test VALUES (c1(i));
28:     END LOOP;
29:     IF NOT CUR%ISOPEN THEN
30:       OPEN CUR;
31:     END IF;
32:     FOR i IN REVERSE 1..5 LOOP
33:       FETCH CUR INTO c1(i);
34:       IF CUR%NOTFOUND THEN
35:         CLOSE CUR;
36:         EXIT;
37:       END IF;
38:     END LOOP;
39:   END iobind;
40: END BUG51253_PKG;"
;
41:
$statement oci_parse($c$create_pkg_body);
42:
oci_execute($statement);
43:
44: echo 
"Test 1\n";
45:
$statement oci_parse($c"BEGIN bug51253_pkg.iobind(:c1); END;");
46:
$array1 = array("one""two""three""four""five");
47:
$array2 $array1;
48:
oci_bind_array_by_name($statement":c1"$array25, -1SQLT_CHR);
49:
oci_execute($statement);
50:
51:
var_dump($array1);
52:
var_dump($array2);
53:
54:
55: echo 
"Test 2\n";
56:
$statement oci_parse($c"BEGIN bug51253_pkg.iobind(:c1); END;");
57:
$array1 = array("one""two""three""four""five");
58:
$array2 = &$array1;
59:
oci_bind_array_by_name($statement":c1"$array25, -1SQLT_CHR);
60:
oci_execute($statement);
61:
62:
var_dump($array1);
63:
var_dump($array2);
64:
65:
66: echo 
"Test 3\n";
67:
$statement oci_parse($c"BEGIN bug51253_pkg.iobind(:c1); END;");
68:
$array1 = array("one""two""three""four""five");
69:
$array2 = &$array1;
70:
oci_bind_array_by_name($statement":c1"$array15, -1SQLT_CHR);
71:
oci_execute($statement);
72:
73:
var_dump($array1);
74:
var_dump($array2);
75:
76:
// Cleanup
77:
$statement oci_parse($c"DROP PACKAGE BUG51253_PKG");
78: @
oci_execute($statement);
79:
$statement oci_parse($c"DROP TABLE BIND_TEST");
80: @
oci_execute($statement);
81:
82: echo 
"Done\n";
83:
?>
84:

Expected

Test 1
array(5) {
  [0]=>
  string(3) "one"
  [1]=>
  string(3) "two"
  [2]=>
  string(5) "three"
  [3]=>
  string(4) "four"
  [4]=>
  string(4) "five"
}
array(5) {
  [0]=>
  string(4) "five"
  [1]=>
  string(4) "four"
  [2]=>
  string(5) "three"
  [3]=>
  string(3) "two"
  [4]=>
  string(3) "one"
}
Test 2
array(5) {
  [0]=>
  string(3) "one"
  [1]=>
  string(3) "two"
  [2]=>
  string(5) "three"
  [3]=>
  string(4) "four"
  [4]=>
  string(4) "five"
}
array(5) {
  [0]=>
  string(3) "one"
  [1]=>
  string(3) "two"
  [2]=>
  string(5) "three"
  [3]=>
  string(4) "four"
  [4]=>
  string(4) "five"
}
Test 3
array(5) {
  [0]=>
  string(4) "five"
  [1]=>
  string(4) "four"
  [2]=>
  string(5) "three"
  [3]=>
  string(3) "two"
  [4]=>
  string(3) "one"
}
array(5) {
  [0]=>
  string(4) "five"
  [1]=>
  string(4) "four"
  [2]=>
  string(5) "three"
  [3]=>
  string(3) "two"
  [4]=>
  string(3) "one"
}
Done

Output

***********************************************************************
Fatal NI connect error 12541, connecting to:
 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))

  VERSION INFORMATION:
	TNS for Linux: Version 11.2.0.2.0 - Beta
	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
  Time: 17-JUN-2018 05:06:35
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12541
    TNS-12541: TNS:no listener
    ns secondary err code: 12560
    nt main err code: 511
    TNS-00511: No listener

Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
    nt secondary err code: 111
    nt OS err code: 0

Diff

001+ ***********************************************************************
002+ Fatal NI connect error 12541, connecting to:
003+  (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
004+ 
005+   VERSION INFORMATION:
006+ 	TNS for Linux: Version 11.2.0.2.0 - Beta
007+ 	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
008+   Time: 17-JUN-2018 05:06:35
009+   Tracing not turned on.
010+   Tns error struct:
011+     ns main err code: 12541
012+     TNS-12541: TNS:no listener
013+     ns secondary err code: 12560
014+     nt main err code: 511
015+     TNS-00511: No listener
016+ 
017+ Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
018+     nt secondary err code: 111
019+     nt OS err code: 0
001- Test 1
002- array(5) {
003-   [0]=>
004-   string(3) "one"
005-   [1]=>
006-   string(3) "two"
007-   [2]=>
008-   string(5) "three"
009-   [3]=>
010-   string(4) "four"
011-   [4]=>
012-   string(4) "five"
013- }
014- array(5) {
015-   [0]=>
016-   string(4) "five"
017-   [1]=>
018-   string(4) "four"
019-   [2]=>
020-   string(5) "three"
021-   [3]=>
022-   string(3) "two"
023-   [4]=>
024-   string(3) "one"
025- }
026- Test 2
027- array(5) {
028-   [0]=>
029-   string(3) "one"
030-   [1]=>
031-   string(3) "two"
032-   [2]=>
033-   string(5) "three"
034-   [3]=>
035-   string(4) "four"
036-   [4]=>
037-   string(4) "five"
038- }
039- array(5) {
040-   [0]=>
041-   string(3) "one"
042-   [1]=>
043-   string(3) "two"
044-   [2]=>
045-   string(5) "three"
046-   [3]=>
047-   string(4) "four"
048-   [4]=>
049-   string(4) "five"
050- }
051- Test 3
052- array(5) {
053-   [0]=>
054-   string(4) "five"
055-   [1]=>
056-   string(4) "four"
057-   [2]=>
058-   string(5) "three"
059-   [3]=>
060-   string(3) "two"
061-   [4]=>
062-   string(3) "one"
063- }
064- array(5) {
065-   [0]=>
066-   string(4) "five"
067-   [1]=>
068-   string(4) "four"
069-   [2]=>
070-   string(5) "three"
071-   [3]=>
072-   string(3) "two"
073-   [4]=>
074-   string(3) "one"
075- }
076- Done

 

Generated at Mon, 18 Jun 2018 17:33:50 +0000 (2 days ago)

Copyright © 2005-2018 The PHP Group
All rights reserved.