forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14473.php
More file actions
27 lines (17 loc) · 974 Bytes
/
bug-14473.php
File metadata and controls
27 lines (17 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php declare(strict_types = 1);
namespace Bug14473;
$link = mysqli_connect('host', 'user', 'pass', 'database') or die('Could not connect: ' . mysqli_connect_error());
// (assume long-running code that can cause the connection to time out)
$link = mysqli_connect('host', 'user', 'pass', 'database') or die('Could not reconnect: ' . mysqli_connect_error());
// okay, so let's make certain that the connection is closed
mysqli_close($link);
$link = mysqli_connect('host', 'user', 'pass', 'database') or die('Could not reconnect: ' . mysqli_connect_error());
// close it and destroy the variable
mysqli_close($link);
unset($link);
$link = mysqli_connect('host', 'user', 'pass', 'database') or die('Could not reconnect: ' . mysqli_connect_error());
// close, destroy ...
mysqli_close($link);
unset($link);
// ... and assign to a different variable
$newLink = mysqli_connect('host', 'user', 'pass', 'database') or die('Could not reconnect: ' . mysqli_connect_error());