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_029.phpt ('OCI PDO Common: extending PDO (3)')

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:         echo 
__METHOD__ "()\n";
19:     }
20:     
21:     function 
__destruct()
22:     {
23:         echo 
__METHOD__ "()\n";
24:     }
25:     
26:     function 
execute($params = array())
27:     {
28:         echo 
__METHOD__ "()\n";
29:         
parent::execute();        
30:     }
31: }
32:
33: class 
PDODatabase extends PDO
34:
{
35:     function 
__destruct()
36:     {
37:         echo 
__METHOD__ "()\n";
38:     }
39:     
40:     function 
query($sql)
41:     {
42:         echo 
__METHOD__ "()\n";
43:         
$stmt $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
44:         
$stmt->setFetchMode(PDO::FETCH_ASSOC);
45:         
$stmt->execute();
46:         return 
$stmt;
47:     }
48: }
49:
50:
$db PDOTest::factory('PDODatabase');
51:
var_dump(get_class($db));
52:
53:
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
54:
55:
$stmt $db->prepare("INSERT INTO test VALUES(?, ?, ?)");
56:
var_dump(get_class($stmt));
57: foreach (
$data as $row) {
58:     
$stmt->execute($row);
59: }
60:
61: unset(
$stmt);
62:
63: echo 
"===QUERY===\n";
64:
65:
$stmt $db->query('SELECT * FROM test');
66:
var_dump(get_class($stmt));
67:
var_dump(get_class($stmt->dbh));
68:
69: echo 
"===FOREACH===\n";
70:
71: foreach(
$stmt as $obj) {
72:     
var_dump($obj);
73: }
74:
75: echo 
"===DONE===\n";
76: exit(
0);
77:
?>
78:

Expected

string(11) "PDODatabase"
string(12) "PDOStatement"
===QUERY===
PDODatabase::query()
PDOStatementX::__construct()
PDOStatementX::execute()
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:38
  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_029.php(50): 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_029.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:38
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_029.php(50): 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- PDODatabase::query()
005- PDOStatementX::__construct()
006- PDOStatementX::execute()
007- string(13) "PDOStatementX"
008- string(11) "PDODatabase"
009- ===FOREACH===
010- array(3) {
011-   ["id"]=>
012-   string(2) "10"
013-   ["val"]=>
014-   string(3) "Abc"
015-   ["val2"]=>
016-   string(3) "zxy"
017- }
018- array(3) {
019-   ["id"]=>
020-   string(2) "20"
021-   ["val"]=>
022-   string(3) "Def"
023-   ["val2"]=>
024-   string(3) "wvu"
025- }
026- array(3) {
027-   ["id"]=>
028-   string(2) "30"
029-   ["val"]=>
030-   string(3) "Ghi"
031-   ["val2"]=>
032-   string(3) "tsr"
033- }
034- ===DONE===
035- PDOStatementX::__destruct()
036- PDODatabase::__destruct()

 

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

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