mysqli bind_param does not set $stmt->error or $stmt->errno
===

According to the php manual you can retrieve errors in any prepared statement method by interrogating $stmt->error and $stmt->errno however the bind_param method never seems to set these on an error, can anyone else confirm this? or tell me what I am missing please?

For example:

    echo "Start\n";
    $db = new mysqli('localhost','test','xxxxxx','test');
    
    $val = 1;
    
    $st = $db->prepare('insert into tblTest set field1=?');
    if($st == false)
    {
        printf("prepare: %s %d\n",$db->error,$st->errno);
    }
    
    $rs = $st->bind_param('is', $val);
    if($rs == false)
    {
        printf("bind_param: %s %d\n",$st->error,$st->errno);
    }
    
    $rs = $st->execute();
    if($rs == false)
    {
        printf("execute: %s %d\n",$st->error,$st->errno);
    }
    
    $rs = $st->close();
    if($rs == false)
    {
        printf("close: %s %d\n",$st->error,$st->errno);
    }
    echo "Finish\n";

Running the above from the command line displays:

Start
PHP Warning:  mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables in test.php on line 14
bind_param: 0
execute: No data supplied for parameters in prepared statement 2031
Finish

So php is seeing this as a Warning, bind_param is returning false, but error & errno are not set. execute is also failing and has correctly set error & errno

Is this a bug?

Thanks
