Annotation of embedaddon/php/ext/pdo_mysql/tests/bug_61755.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #61755 (A parsing bug in the prepared statements can lead to access violations)
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6: require dirname(__FILE__) . '/config.inc';
7: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
8: PDOTest::skip();
9: ?>
10: --FILE--
11: <?php
12: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
13: $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
14:
15: $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
16:
17: echo "NULL-Byte before first placeholder:\n";
18: $s = $db->prepare("SELECT \"a\0b\", ?");
19: $s->bindValue(1,"c");
20: $s->execute();
21: $r = $s->fetch();
22: echo "Length of item 0: ".strlen($r[0]).", Value of item 1: ".$r[1]."\n";
23:
24: echo "\nOpen comment:\n";
25: try {
26: $s = $db->prepare("SELECT /*");
27: $s->execute();
28: } catch (Exception $e) {
29: echo "Error code: ".$e->getCode()."\n";
30: }
31:
32: echo "\ndone!\n";
33: ?>
34: --EXPECTF--
35: NULL-Byte before first placeholder:
36: Length of item 0: 3, Value of item 1: c
37:
38: Open comment:
39: Error code: 42000
40:
41: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>