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/bug_71447.phpt ('OCI PDO Common: Bug #71447 (Quotes inside comments not properly handled)')

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:
$db PDOTest::factory();
6:
$db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
7:
$db->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_NUM);
8:
$db->setAttribute (\PDO::ATTR_EMULATE_PREPARESfalse);
9:
$db->exec('CREATE TABLE test(id int)');
10:
$db->exec('INSERT INTO test VALUES(1)');
11:
12:
// Comment without quotes or placeholders
13:
$stmt $db->prepare("
14:     SELECT -- Thats all folks!
15:         '\"abc\":8000'
16:     FROM test
17: "
);
18:
19:
$stmt->execute();
20:
var_dump($stmt->fetchColumn());
21:
22:
// Comment and placeholder within a string
23:
$stmt $db->prepare("
24:     SELECT
25:         '\"abc\":8001 -- Wat?'
26:     FROM test
27: "
);
28:
29:
$stmt->execute();
30:
var_dump($stmt->fetchColumn());
31:
32:
// Comment with single quote
33:
$stmt $db->prepare("
34:     SELECT -- That's all folks!
35:         '\"abc\":8002'
36:     FROM test
37: "
);
38:
39:
$stmt->execute();
40:
var_dump($stmt->fetchColumn());
41:
42:
// C-Style comment with single quote
43:
$stmt $db->prepare("
44:     SELECT /* That's all folks! */
45:         '\"abc\":8003'
46:     FROM test
47: "
);
48:
49:
$stmt->execute();
50:
var_dump($stmt->fetchColumn());
51:
52:
// Comment with double quote
53:
$stmt $db->prepare("
54:     SELECT -- Is it only \"single quotes?
55:         '\"abc\":8004'
56:     FROM test
57: "
);
58:
59:
$stmt->execute();
60:
var_dump($stmt->fetchColumn());
61:
62:
// Comment with ? placeholder
63:
$stmt $db->prepare("
64:     SELECT -- What about question marks here?
65:         *
66:     FROM test
67:     WHERE id = ?
68: "
);
69:
70:
$stmt->execute([1]);
71:
var_dump($stmt->fetchColumn());
72:
73:
// Comment with named placeholder
74:
$stmt $db->prepare("
75:     SELECT -- What about placeholders :bar
76:         *
77:     FROM test
78:     WHERE id = :id
79: "
);
80:
81:
$stmt->execute(['id' => 1]);
82:
var_dump($stmt->fetchColumn());
83:
84:
85:
?>
86:

Expected

string(10) ""abc":8000"
string(18) ""abc":8001 -- Wat?"
string(10) ""abc":8002"
string(10) ""abc":8003"
string(10) ""abc":8004"
string(1) "1"
string(1) "1"

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:40:24
  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/bug_71447.php(5): 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/bug_71447.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
001- string(10) ""abc":8000"
002- string(18) ""abc":8001 -- Wat?"
003- string(10) ""abc":8002"
004- string(10) ""abc":8003"
005- string(10) ""abc":8004"
006- string(1) "1"
007- string(1) "1"
008+   Time: 17-JUN-2018 09:40:24
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/bug_71447.php(5): 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

 

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

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