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_011.phpt ('OCI PDO Common: PDO::FETCH_FUNC and statement overloading')

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\', \'Group1\')'); 
9:
$db->exec('INSERT INTO test VALUES(3, \'C\', \'Group2\')'); 
10:
$db->exec('INSERT INTO test VALUES(4, \'D\', \'Group2\')'); 
11:
12: class 
DerivedStatement extends PDOStatement
13:
{
14:     private function 
__construct($name$db)
15:     {
16:         
$this->name $name;
17:         echo 
__METHOD__ "($name)\n";
18:     }
19:
20:     function 
reTrieve($id$val) {
21:         echo 
__METHOD__ "($id,$val)\n";
22:         return array(
$id=>$val);
23:     }
24: }
25:
26:
$select1 $db->prepare('SELECT grp, id FROM test');
27:
$select2 $db->prepare('SELECT id, val FROM test');
28:
$derived $db->prepare('SELECT id, val FROM test', array(PDO::ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded'$db))));
29:
30: class 
Test1
31:
{
32:     public function 
__construct($id$val)
33:     {
34:         echo 
__METHOD__ "($id,$val)\n";
35:         
$this->id $id;
36:         
$this->val $val;
37:     }
38:
39:     static public function 
factory($id$val)
40:     {
41:         echo 
__METHOD__ "($id,$val)\n";
42:         return new 
self($id$val);
43:     }
44: }
45:
46: function 
test($id,$val='N/A')
47: {
48:     echo 
__METHOD__ "($id,$val)\n";
49:     return array(
$id=>$val);
50: }
51:
52:
$f = new Test1(0,0);
53:
54:
$select1->execute();
55:
var_dump($select1->fetchAll(PDO::FETCH_FUNC|PDO::FETCH_GROUP'test'));
56:
57:
$select2->execute();
58:
var_dump($select2->fetchAll(PDO::FETCH_FUNC'test'));
59:
60:
$select2->execute();
61:
var_dump($select2->fetchAll(PDO::FETCH_FUNC, array('Test1','factory')));
62:
63:
$select2->execute();
64:
var_dump($select2->fetchAll(PDO::FETCH_FUNC, array($f'factory')));
65:
66:
var_dump(get_class($derived));
67:
$derived->execute();
68:
var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived'retrieve')));
69:
$derived->execute();
70:
var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived'reTrieve')));
71:
$derived->execute();
72:
var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived'RETRIEVE')));
73:
74:
?>
75:

Expected

DerivedStatement::__construct(Overloaded)
Test1::__construct(0,0)
test(1,N/A)
test(2,N/A)
test(3,N/A)
test(4,N/A)
array(2) {
  ["Group1"]=>
  array(2) {
    [0]=>
    array(1) {
      [1]=>
      string(3) "N/A"
    }
    [1]=>
    array(1) {
      [2]=>
      string(3) "N/A"
    }
  }
  ["Group2"]=>
  array(2) {
    [0]=>
    array(1) {
      [3]=>
      string(3) "N/A"
    }
    [1]=>
    array(1) {
      [4]=>
      string(3) "N/A"
    }
  }
}
test(1,A)
test(2,B)
test(3,C)
test(4,D)
array(4) {
  [0]=>
  array(1) {
    [1]=>
    string(1) "A"
  }
  [1]=>
  array(1) {
    [2]=>
    string(1) "B"
  }
  [2]=>
  array(1) {
    [3]=>
    string(1) "C"
  }
  [3]=>
  array(1) {
    [4]=>
    string(1) "D"
  }
}
Test1::factory(1,A)
Test1::__construct(1,A)
Test1::factory(2,B)
Test1::__construct(2,B)
Test1::factory(3,C)
Test1::__construct(3,C)
Test1::factory(4,D)
Test1::__construct(4,D)
array(4) {
  [0]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "1"
    ["val"]=>
    string(1) "A"
  }
  [1]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "2"
    ["val"]=>
    string(1) "B"
  }
  [2]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "3"
    ["val"]=>
    string(1) "C"
  }
  [3]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "4"
    ["val"]=>
    string(1) "D"
  }
}
Test1::factory(1,A)
Test1::__construct(1,A)
Test1::factory(2,B)
Test1::__construct(2,B)
Test1::factory(3,C)
Test1::__construct(3,C)
Test1::factory(4,D)
Test1::__construct(4,D)
array(4) {
  [0]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "1"
    ["val"]=>
    string(1) "A"
  }
  [1]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "2"
    ["val"]=>
    string(1) "B"
  }
  [2]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "3"
    ["val"]=>
    string(1) "C"
  }
  [3]=>
  object(Test1)#%d (2) {
    ["id"]=>
    string(1) "4"
    ["val"]=>
    string(1) "D"
  }
}
string(16) "DerivedStatement"
DerivedStatement::reTrieve(1,A)
DerivedStatement::reTrieve(2,B)
DerivedStatement::reTrieve(3,C)
DerivedStatement::reTrieve(4,D)
array(4) {
  [0]=>
  array(1) {
    [1]=>
    string(1) "A"
  }
  [1]=>
  array(1) {
    [2]=>
    string(1) "B"
  }
  [2]=>
  array(1) {
    [3]=>
    string(1) "C"
  }
  [3]=>
  array(1) {
    [4]=>
    string(1) "D"
  }
}
DerivedStatement::reTrieve(1,A)
DerivedStatement::reTrieve(2,B)
DerivedStatement::reTrieve(3,C)
DerivedStatement::reTrieve(4,D)
array(4) {
  [0]=>
  array(1) {
    [1]=>
    string(1) "A"
  }
  [1]=>
  array(1) {
    [2]=>
    string(1) "B"
  }
  [2]=>
  array(1) {
    [3]=>
    string(1) "C"
  }
  [3]=>
  array(1) {
    [4]=>
    string(1) "D"
  }
}
DerivedStatement::reTrieve(1,A)
DerivedStatement::reTrieve(2,B)
DerivedStatement::reTrieve(3,C)
DerivedStatement::reTrieve(4,D)
array(4) {
  [0]=>
  array(1) {
    [1]=>
    string(1) "A"
  }
  [1]=>
  array(1) {
    [2]=>
    string(1) "B"
  }
  [2]=>
  array(1) {
    [3]=>
    string(1) "C"
  }
  [3]=>
  array(1) {
    [4]=>
    string(1) "D"
  }
}

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:43:46
  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_011.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_011.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:43:46
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_011.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- DerivedStatement::__construct(Overloaded)
002- Test1::__construct(0,0)
003- test(1,N/A)
004- test(2,N/A)
005- test(3,N/A)
006- test(4,N/A)
007- array(2) {
008-   ["Group1"]=>
009-   array(2) {
010-     [0]=>
011-     array(1) {
012-       [1]=>
013-       string(3) "N/A"
014-     }
015-     [1]=>
016-     array(1) {
017-       [2]=>
018-       string(3) "N/A"
019-     }
020-   }
021-   ["Group2"]=>
022-   array(2) {
023-     [0]=>
024-     array(1) {
025-       [3]=>
026-       string(3) "N/A"
027-     }
028-     [1]=>
029-     array(1) {
030-       [4]=>
031-       string(3) "N/A"
032-     }
033-   }
034- }
035- test(1,A)
036- test(2,B)
037- test(3,C)
038- test(4,D)
039- array(4) {
040-   [0]=>
041-   array(1) {
042-     [1]=>
043-     string(1) "A"
044-   }
045-   [1]=>
046-   array(1) {
047-     [2]=>
048-     string(1) "B"
049-   }
050-   [2]=>
051-   array(1) {
052-     [3]=>
053-     string(1) "C"
054-   }
055-   [3]=>
056-   array(1) {
057-     [4]=>
058-     string(1) "D"
059-   }
060- }
061- Test1::factory(1,A)
062- Test1::__construct(1,A)
063- Test1::factory(2,B)
064- Test1::__construct(2,B)
065- Test1::factory(3,C)
066- Test1::__construct(3,C)
067- Test1::factory(4,D)
068- Test1::__construct(4,D)
069- array(4) {
070-   [0]=>
071-   object(Test1)#%d (2) {
072-     ["id"]=>
073-     string(1) "1"
074-     ["val"]=>
075-     string(1) "A"
076-   }
077-   [1]=>
078-   object(Test1)#%d (2) {
079-     ["id"]=>
080-     string(1) "2"
081-     ["val"]=>
082-     string(1) "B"
083-   }
084-   [2]=>
085-   object(Test1)#%d (2) {
086-     ["id"]=>
087-     string(1) "3"
088-     ["val"]=>
089-     string(1) "C"
090-   }
091-   [3]=>
092-   object(Test1)#%d (2) {
093-     ["id"]=>
094-     string(1) "4"
095-     ["val"]=>
096-     string(1) "D"
097-   }
098- }
099- Test1::factory(1,A)
100- Test1::__construct(1,A)
101- Test1::factory(2,B)
102- Test1::__construct(2,B)
103- Test1::factory(3,C)
104- Test1::__construct(3,C)
105- Test1::factory(4,D)
106- Test1::__construct(4,D)
107- array(4) {
108-   [0]=>
109-   object(Test1)#%d (2) {
110-     ["id"]=>
111-     string(1) "1"
112-     ["val"]=>
113-     string(1) "A"
114-   }
115-   [1]=>
116-   object(Test1)#%d (2) {
117-     ["id"]=>
118-     string(1) "2"
119-     ["val"]=>
120-     string(1) "B"
121-   }
122-   [2]=>
123-   object(Test1)#%d (2) {
124-     ["id"]=>
125-     string(1) "3"
126-     ["val"]=>
127-     string(1) "C"
128-   }
129-   [3]=>
130-   object(Test1)#%d (2) {
131-     ["id"]=>
132-     string(1) "4"
133-     ["val"]=>
134-     string(1) "D"
135-   }
136- }
137- string(16) "DerivedStatement"
138- DerivedStatement::reTrieve(1,A)
139- DerivedStatement::reTrieve(2,B)
140- DerivedStatement::reTrieve(3,C)
141- DerivedStatement::reTrieve(4,D)
142- array(4) {
143-   [0]=>
144-   array(1) {
145-     [1]=>
146-     string(1) "A"
147-   }
148-   [1]=>
149-   array(1) {
150-     [2]=>
151-     string(1) "B"
152-   }
153-   [2]=>
154-   array(1) {
155-     [3]=>
156-     string(1) "C"
157-   }
158-   [3]=>
159-   array(1) {
160-     [4]=>
161-     string(1) "D"
162-   }
163- }
164- DerivedStatement::reTrieve(1,A)
165- DerivedStatement::reTrieve(2,B)
166- DerivedStatement::reTrieve(3,C)
167- DerivedStatement::reTrieve(4,D)
168- array(4) {
169-   [0]=>
170-   array(1) {
171-     [1]=>
172-     string(1) "A"
173-   }
174-   [1]=>
175-   array(1) {
176-     [2]=>
177-     string(1) "B"
178-   }
179-   [2]=>
180-   array(1) {
181-     [3]=>
182-     string(1) "C"
183-   }
184-   [3]=>
185-   array(1) {
186-     [4]=>
187-     string(1) "D"
188-   }
189- }
190- DerivedStatement::reTrieve(1,A)
191- DerivedStatement::reTrieve(2,B)
192- DerivedStatement::reTrieve(3,C)
193- DerivedStatement::reTrieve(4,D)
194- array(4) {
195-   [0]=>
196-   array(1) {
197-     [1]=>
198-     string(1) "A"
199-   }
200-   [1]=>
201-   array(1) {
202-     [2]=>
203-     string(1) "B"
204-   }
205-   [2]=>
206-   array(1) {
207-     [3]=>
208-     string(1) "C"
209-   }
210-   [3]=>
211-   array(1) {
212-     [4]=>
213-     string(1) "D"
214-   }
215- }

 

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

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