Annotation of embedaddon/php/ext/pdo_mysql/tests/bug54929.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #54929 (Parse error with single quote in sql comment (pdo-mysql))
! 3: --SKIPIF--
! 4: <?php
! 5: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
! 6: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
! 7: MySQLPDOTest::skip();
! 8:
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12:
! 13: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
! 14:
! 15: $pdodb = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
! 16:
! 17:
! 18: function testQuery($query) {
! 19: global $pdodb;
! 20: $stmt = $pdodb->prepare($query);
! 21:
! 22: if (!$stmt->execute(array("foo"))) {
! 23: var_dump($stmt->errorInfo());
! 24: } else{
! 25: var_dump($stmt->fetch(PDO::FETCH_ASSOC));
! 26: }
! 27: }
! 28:
! 29: testQuery("/* ' */ select ? as f1 /* ' */");
! 30: testQuery("/* '-- */ select ? as f1 /* *' */");
! 31: testQuery("/* ' */ select ? as f1 --';");
! 32: testQuery("/* ' */ select ? as f1 -- 'a;");
! 33: testQuery("/*'**/ select ? as f1 /* ' */");
! 34: testQuery("/*'***/ select ? as f1 /* ' */");
! 35: testQuery("/*'**a ***b / ****
! 36: ******
! 37: **/ select ? as f1 /* ' */");
! 38:
! 39: ?>
! 40: --EXPECTF--
! 41: array(1) {
! 42: ["f1"]=>
! 43: string(3) "foo"
! 44: }
! 45: array(1) {
! 46: ["f1"]=>
! 47: string(3) "foo"
! 48: }
! 49:
! 50: Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--'' at line 1 in %s on line %d
! 51: array(3) {
! 52: [0]=>
! 53: string(5) "42000"
! 54: [1]=>
! 55: int(1064)
! 56: [2]=>
! 57: string(149) "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--'' at line 1"
! 58: }
! 59: array(1) {
! 60: ["f1"]=>
! 61: string(3) "foo"
! 62: }
! 63: array(1) {
! 64: ["f1"]=>
! 65: string(3) "foo"
! 66: }
! 67: array(1) {
! 68: ["f1"]=>
! 69: string(3) "foo"
! 70: }
! 71: array(1) {
! 72: ["f1"]=>
! 73: string(3) "foo"
! 74: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>