summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-02-19 14:53:44 +0000
committerFelipe Pena <felipe@php.net>2008-02-19 14:53:44 +0000
commit5ccd0528fe1a2812dd2265f23ce3c9a1bbfb78b9 (patch)
treeb995bfc0c4f131f8f94955c0181dd7a0bea62624
parentd0fea1442867538e201853681844c6a92e64cbd1 (diff)
downloadphp-git-5ccd0528fe1a2812dd2265f23ce3c9a1bbfb78b9.tar.gz
New test
-rw-r--r--ext/pdo/tests/bug_44159.phpt32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159.phpt
new file mode 100644
index 0000000000..e57a9882e6
--- /dev/null
+++ b/ext/pdo/tests/bug_44159.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL))
+--FILE--
+<?php
+
+$pdo = new PDO("sqlite:/tmp/foo.db");
+
+$attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING);
+
+foreach ($attrs as $attr) {
+ var_dump($pdo->setAttribute($attr, NULL));
+ var_dump($pdo->setAttribute($attr, 1));
+ var_dump($pdo->setAttribute($attr, 'nonsense'));
+}
+
+?>
+--EXPECTF--
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+