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_014.phpt ('OCI PDO Common: PDOStatement SPL iterator')

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:
$db PDOTest::factory();
5:
6:
$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))');
7:
$db->exec('INSERT INTO test VALUES(1, \'A\', \'Group1\')');
8:
$db->exec('INSERT INTO test VALUES(2, \'B\', \'Group2\')');
9:
$SELECT 'SELECT val, grp FROM test';
10:
11: class 
Test
12:
{
13:     function 
__construct($name 'N/A')
14:     {
15:         echo 
__METHOD__ "($name)\n";
16:     }
17: }
18:
19:
$stmt $db->query($SELECTPDO::FETCH_CLASS'Test', array('WOW'));
20:
21:
$it = new IteratorIterator($stmt); /* check if we can convert that thing */
22:
23: /*** HINT: If YOU plan to do so remember not to call rewind() -> see below ***/
24:
25:
foreach($it as $data)
26: {
27:     
var_dump($data);
28: }
29:
30:
$it->next();              /* must be allowed */
31:
var_dump($it->current()); /* must return NULL */
32:
var_dump($it->valid());   /* must return false */
33:
34:
class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
35:
{
36:     private function 
__construct()
37:     {
38:         echo 
__METHOD__ "\n";
39:         
$this->setFetchMode(PDO::FETCH_NUM);
40:         
/* default fetch mode is BOTH, so we see if the ctor can overwrite that */
41:     
}
42:
43:     function 
getIterator()
44:     {
45:         echo 
__METHOD__ "\n";
46:         
$this->execute();
47:         return new 
IteratorIterator($this'PDOStatement');
48:     }
49: }
50:
51:
$stmt $db->prepare($SELECT, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate')));
52:
53: foreach(
$stmt as $data)
54: {
55:     
var_dump($data);
56: }
57:
58:
?>
59:

Expected

Test::__construct(WOW)
object(Test)#%d (2) {
  ["val"]=>
  string(1) "A"
  ["grp"]=>
  string(6) "Group1"
}
Test::__construct(WOW)
object(Test)#%d (2) {
  ["val"]=>
  string(1) "B"
  ["grp"]=>
  string(6) "Group2"
}
NULL
bool(false)
PDOStatementAggregate::__construct
PDOStatementAggregate::getIterator
array(2) {
  [0]=>
  string(1) "A"
  [1]=>
  string(6) "Group1"
}
array(2) {
  [0]=>
  string(1) "B"
  [1]=>
  string(6) "Group2"
}

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:44:29
  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_014.php(4): PDOTest::factory()
#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_014.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:44:29
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_014.php(4): PDOTest::factory()
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- Test::__construct(WOW)
002- object(Test)#%d (2) {
003-   ["val"]=>
004-   string(1) "A"
005-   ["grp"]=>
006-   string(6) "Group1"
007- }
008- Test::__construct(WOW)
009- object(Test)#%d (2) {
010-   ["val"]=>
011-   string(1) "B"
012-   ["grp"]=>
013-   string(6) "Group2"
014- }
015- NULL
016- bool(false)
017- PDOStatementAggregate::__construct
018- PDOStatementAggregate::getIterator
019- array(2) {
020-   [0]=>
021-   string(1) "A"
022-   [1]=>
023-   string(6) "Group1"
024- }
025- array(2) {
026-   [0]=>
027-   string(1) "B"
028-   [1]=>
029-   string(6) "Group2"
030- }

 

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

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