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_firebird/tests/bug_71447.phpt ('FIREBIRD 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

string(10) ""abc":8000"
string(18) ""abc":8001 -- Wat?"
string(6) ""abc"?"
string(6) ""abc"?"
string(10) ""abc":8004"
string(1) "1"
bool(false)

Diff

# original source file: ext/pdo/tests/bug_71447.phpt
003+ string(6) ""abc"?"
004+ string(6) ""abc"?"
003- string(10) ""abc":8002"
004- string(10) ""abc":8003"
007+ bool(false)
007- string(1) "1"

 

Generated at Sun, 12 Nov 2017 21:17:35 +0000 (11 days ago)

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