bug53551.phpt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --TEST--
  2. Bug #44327 (PDORow::queryString property & numeric offsets / Crash)
  3. --EXTENSIONS--
  4. pdo_mysql
  5. --SKIPIF--
  6. <?php
  7. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  8. MySQLPDOTest::skip();
  9. $db = MySQLPDOTest::factory();
  10. ?>
  11. --FILE--
  12. <?php
  13. include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
  14. $db = MySQLPDOTest::factory();
  15. $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
  16. $createSql = "CREATE TABLE `bug53551` (
  17. `count` bigint(20) unsigned NOT NULL DEFAULT '0'
  18. )";
  19. $db->exec('drop table if exists bug53551');
  20. $db->exec($createSql);
  21. $db->exec("insert into bug53551 set `count` = 1 ");
  22. $db->exec("SET sql_mode = 'Traditional'");
  23. $sql = 'UPDATE bug53551 SET `count` = :count';
  24. $stmt = $db->prepare($sql);
  25. $values = array (
  26. 'count' => NULL,
  27. );
  28. echo "1\n";
  29. $stmt->execute($values);
  30. var_dump($stmt->errorInfo());
  31. echo "2\n";
  32. $stmt->execute($values);
  33. var_dump($stmt->errorInfo());
  34. echo "\ndone\n";
  35. ?>
  36. --CLEAN--
  37. <?php
  38. include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
  39. $db = MySQLPDOTest::factory();
  40. $db->exec('DROP TABLE IF EXISTS bug53551');
  41. ?>
  42. --EXPECTF--
  43. 1
  44. Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'count' cannot be null in %s on line %d
  45. array(3) {
  46. [0]=>
  47. string(5) "23000"
  48. [1]=>
  49. int(1048)
  50. [2]=>
  51. string(29) "Column 'count' cannot be null"
  52. }
  53. 2
  54. Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'count' cannot be null in %s on line %d
  55. array(3) {
  56. [0]=>
  57. string(5) "23000"
  58. [1]=>
  59. int(1048)
  60. [2]=>
  61. string(29) "Column 'count' cannot be null"
  62. }
  63. done