bug53551.phpt 1.6 KB

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