Annotation of embedaddon/php/ext/pdo/tests/bug_44159.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL))
        !             3: --SKIPIF--
        !             4: <?php # vim:ft=php
        !             5: if (!extension_loaded('pdo')) die('skip PDO not available');
        !             6: try {
        !             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: 
        !            18: foreach ($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--
        !            28: 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
        !            29: bool(false)
        !            30: 
        !            31: 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
        !            32: bool(false)
        !            33: 
        !            34: 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
        !            35: bool(false)
        !            36: 
        !            37: Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: attribute value must be an integer in %s on line %d
        !            38: bool(false)
        !            39: bool(true)
        !            40: bool(true)
        !            41: bool(true)
        !            42: bool(true)
        !            43: bool(true)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>