1--TEST-- 2Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)) 3--SKIPIF-- 4<?php # vim:ft=php 5if (!extension_loaded('pdo')) die('skip PDO not available'); 6try { 7 $pdo = new PDO("sqlite:".__DIR__."/foo.db"); 8} catch (Exception $e) { 9 die("skip PDP_SQLITE not available"); 10} 11?> 12--FILE-- 13<?php 14$pdo = new PDO("sqlite:".__DIR__."/foo.db"); 15 16$attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING); 17 18foreach ($attrs as $attr) { 19 var_dump($pdo->setAttribute($attr, NULL)); 20 var_dump($pdo->setAttribute($attr, 1)); 21 var_dump($pdo->setAttribute($attr, 'nonsense')); 22} 23 24@unlink(__DIR__."/foo.db"); 25 26?> 27--EXPECTF-- 28Warning: 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 29bool(false) 30 31Warning: 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 32bool(false) 33 34Warning: 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 35bool(false) 36 37Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: attribute value must be an integer in %s on line %d 38bool(false) 39bool(true) 40bool(true) 41bool(true) 42bool(true) 43bool(true) 44