-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't assert mysql->mysql is non-null
There is an edge case in constructor behavior where we can end up with mysql->mysql being NULL (rather than mysql itself already being NULL). I think that ultimately that's a bug in the constructor code, and we should probably be destroying the outer structure on construction failure as well. However it's pretty hard to unravel with when considering all the construction permutations.
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Incomplete initialization edge case where mysql->mysql is NULL | ||
--SKIPIF-- | ||
<?php | ||
require_once('skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$mysqli = new mysqli(); | ||
$mysqli->__construct(null); | ||
$mysqli->close(); | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: mysqli::__construct(): (HY000/2002): No such file or directory in %s on line %d | ||
|
||
Fatal error: Uncaught Error: mysqli object is not fully initialized in %s:%d | ||
Stack trace: | ||
#0 %s(%d): mysqli->close() | ||
#1 {main} | ||
thrown in %s on line %d |