1--TEST--
2mysqli_stmt_execute() - bind in execute - not supported with libmysql
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8if ($IS_MYSQLND) {
9    die("skip only applicable for libmysqlclient");
10}
11?>
12--FILE--
13<?php
14require_once "connect.inc";
15
16require 'table.inc';
17
18mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
19
20// first, control case
21$id = 1;
22$abc = 'abc';
23$stmt = $link->prepare('SELECT label, ? AS anon, ? AS num FROM test WHERE id=?');
24$stmt->bind_param('sss', ...[&$abc, 42, $id]);
25$stmt->execute();
26$stmt->bind_result($v1, $v2, $v3);
27$stmt->fetch();
28assert(['label'=>$v1, 'anon'=>$v2, 'num'=>$v3] === ['label'=>'a', 'anon'=>'abc', 'num'=>'42']);
29$stmt = null;
30
31// 1. same as the control case, but skipping the middle-man (bind_param)
32$stmt = $link->prepare('SELECT label, ? AS anon, ? AS num FROM test WHERE id=?');
33try {
34    $stmt->execute([&$abc, 42, $id]);
35} catch (ArgumentCountError $e) {
36    echo '[001] '.$e->getMessage()."\n";
37}
38$stmt = null;
39
40mysqli_close($link);
41?>
42--CLEAN--
43<?php
44require_once "clean_table.inc";
45?>
46--EXPECT--
47[001] Binding parameters in execute is not supported with libmysqlclient
48