source: src/router/php7/ext/mysqli/tests/bug69899.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 954 bytes
Line 
1--TEST--
2Bug #69899: Segfault on stmt close after free_result with mysqlnd.
3--DESCRIPTION--
4The segfault happens only if the database connection was already closed and
5free_result is called on a prepared statement followed by closing that
6statement. This is due to mysqlnd_stmt::free_result (mysqlnd_ps.c) which
7unconditionally sets the connection of the statement to ready, despite the fact
8that it might already be closed.
9--SKIPIF--
10<?php
11require_once __DIR__ . '/skipif.inc';
12require_once __DIR__ . '/skipifconnectfailure.inc';
13require_once __DIR__ . '/connect.inc';
14if (!$IS_MYSQLND) {
15        die('mysqlnd only');
16}
17?>
18--FILE--
19<?php
20
21require_once __DIR__ . '/connect.inc';
22
23mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
24
25$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
26$stmt   = $mysqli->prepare('SELECT 1');
27
28var_dump(
29        $mysqli->close(),
30        $stmt->free_result(),
31        $stmt->close()
32);
33
34?>
35--EXPECT--
36bool(true)
37NULL
38bool(true)
Note: See TracBrowser for help on using the repository browser.