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/pdo_oci/tests/pdo_030.phpt ('OCI PDO Common: extending PDO (4)')

Script

1: <?php
2:
if (getenv('REDIR_TEST_DIR') === falseputenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 
3: require_once 
getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
4:
5:
$data = array(
6:     array(
'10''Abc''zxy'),
7:     array(
'20''Def''wvu'),
8:     array(
'30''Ghi''tsr'),
9: );
10:
11: class 
PDOStatementX extends PDOStatement
12:
{
13:     public 
$dbh;
14:     
15:     protected function 
__construct($dbh)
16:     {
17:         
$this->dbh $dbh;
18:         
$this->setFetchMode(PDO::FETCH_ASSOC);
19:         echo 
__METHOD__ "()\n";
20:     }
21:     
22:     function 
__destruct()
23:     {
24:         echo 
__METHOD__ "()\n";
25:     }
26:     
27:     function 
execute($params = array())
28:     {
29:         echo 
__METHOD__ "()\n";
30:         
parent::execute();        
31:     }
32: }
33:
34: class 
PDODatabase extends PDO
35:
{
36:     function 
__destruct()
37:     {
38:         echo 
__METHOD__ "()\n";
39:     }
40:     
41:     function 
query($sql)
42:     {
43:         echo 
__METHOD__ "()\n";
44:         return 
parent::query($sql);
45:     }
46: }
47:
48:
$db PDOTest::factory('PDODatabase');
49:
var_dump(get_class($db));
50:
51:
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
52:
53:
$stmt $db->prepare("INSERT INTO test VALUES(?, ?, ?)");
54:
var_dump(get_class($stmt));
55: foreach (
$data as $row) {
56:     
$stmt->execute($row);
57: }
58:
59: unset(
$stmt);
60:
61: echo 
"===QUERY===\n";
62:
63:
var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
64:
$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatementx', array($db)));
65:
var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
66:
$stmt $db->query('SELECT * FROM test');
67:
var_dump(get_class($stmt));
68:
var_dump(get_class($stmt->dbh));
69:
70: echo 
"===FOREACH===\n";
71:
72: foreach(
$stmt as $obj) {
73:     
var_dump($obj);
74: }
75:
76: echo 
"===DONE===\n";
77: exit(
0);
78:
?>
79:

Expected

string(11) "PDODatabase"
string(12) "PDOStatement"
===QUERY===
array(1) {
  [0]=>
  string(12) "PDOStatement"
}
array(2) {
  [0]=>
  string(13) "PDOStatementX"
  [1]=>
  array(1) {
    [0]=>
    object(PDODatabase)#%d (0) {
    }
  }
}
PDODatabase::query()
PDOStatementX::__construct()
string(13) "PDOStatementX"
string(11) "PDODatabase"
===FOREACH===
array(3) {
  ["id"]=>
  string(2) "10"
  ["val"]=>
  string(3) "Abc"
  ["val2"]=>
  string(3) "zxy"
}
array(3) {
  ["id"]=>
  string(2) "20"
  ["val"]=>
  string(3) "Def"
  ["val2"]=>
  string(3) "wvu"
}
array(3) {
  ["id"]=>
  string(2) "30"
  ["val"]=>
  string(3) "Ghi"
  ["val2"]=>
  string(3) "tsr"
}
===DONE===
PDOStatementX::__destruct()
PDODatabase::__destruct()

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 09:47:53
  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: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
 (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
#1 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/pdo_030.php(48): PDOTest::factory('PDODatabase')
#2 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
    nt secondary err code: 111
    nt OS err code: 0

Diff

# original source file: ext/pdo/tests/pdo_030.phpt
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 09:47:53
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: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
018+  (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
019+ Stack trace:
020+ #0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
021+ #1 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/pdo_030.php(48): PDOTest::factory('PDODatabase')
022+ #2 {main}
023+   thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
024+     nt secondary err code: 111
025+     nt OS err code: 0
001- string(11) "PDODatabase"
002- string(12) "PDOStatement"
003- ===QUERY===
004- array(1) {
005-   [0]=>
006-   string(12) "PDOStatement"
007- }
008- array(2) {
009-   [0]=>
010-   string(13) "PDOStatementX"
011-   [1]=>
012-   array(1) {
013-     [0]=>
014-     object(PDODatabase)#%d (0) {
015-     }
016-   }
017- }
018- PDODatabase::query()
019- PDOStatementX::__construct()
020- string(13) "PDOStatementX"
021- string(11) "PDODatabase"
022- ===FOREACH===
023- array(3) {
024-   ["id"]=>
025-   string(2) "10"
026-   ["val"]=>
027-   string(3) "Abc"
028-   ["val2"]=>
029-   string(3) "zxy"
030- }
031- array(3) {
032-   ["id"]=>
033-   string(2) "20"
034-   ["val"]=>
035-   string(3) "Def"
036-   ["val2"]=>
037-   string(3) "wvu"
038- }
039- array(3) {
040-   ["id"]=>
041-   string(2) "30"
042-   ["val"]=>
043-   string(3) "Ghi"
044-   ["val2"]=>
045-   string(3) "tsr"
046- }
047- ===DONE===
048- PDOStatementX::__destruct()
049- PDODatabase::__destruct()

 

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

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