xref: /PHP-8.1/ext/mysqli/tests/gh8978.phpt (revision ffd398b4)
1--TEST--
2Bug GH-8267 (Invalid error message when connection via SSL fails)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11require_once "connect.inc";
12
13mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
14$mysql = mysqli_init();
15// Ignore this warning as we are providing wrong information on purpose
16mysqli_ssl_set($mysql, 'x509.key', 'x509.pem', 'x509.ca', null, null);
17try {
18    // There should be no warning here, only exception
19    mysqli_real_connect($mysql, $host, $user, $passwd, null, $port, null, MYSQLI_CLIENT_SSL);
20} catch (mysqli_sql_exception $e) {
21    echo $e->getMessage()."\n";
22}
23
24echo 'done!';
25?>
26--EXPECTF--
27Warning: failed loading cafile stream: `x509.ca' in %s
28Cannot connect to MySQL using SSL
29done!
30