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

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

Expected

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

 

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

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