]> granicus.if.org Git - php/commitdiff
New test
authorFelipe Pena <felipe@php.net>
Tue, 19 Feb 2008 14:53:44 +0000 (14:53 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 19 Feb 2008 14:53:44 +0000 (14:53 +0000)
ext/pdo/tests/bug_44159.phpt [new file with mode: 0644]

diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159.phpt
new file mode 100644 (file)
index 0000000..e57a988
--- /dev/null
@@ -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)
+