summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2009-11-12 17:48:36 +0000
committerJohannes Schlüter <johannes@php.net>2009-11-12 17:48:36 +0000
commitb1997d6557739800df05ec4b869c5990ccd7cb72 (patch)
tree16c9c9c978160b2e8c6ae03ef2521f0f52baa7e4
parent368e8230de9115c65dcdc4b60de144ea38d300ba (diff)
downloadphp-git-b1997d6557739800df05ec4b869c5990ccd7cb72.tar.gz
Merge 290570 (Fix bug #49098). (Rasmus)
-rw-r--r--NEWS1
-rw-r--r--ext/mysqli/mysqli_nonapi.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index aa12a17792..ea734e1632 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP NEWS
elmerot dot se)
- Fixed bug #49910 (no support for ././@LongLink for long filenames in phar
tar support). (Greg)
+- Fixed bug #49098 (mysqli segfault on error) (Rasmus)
03 Nov 2009, PHP 5.3.1 RC3
- Added "max_file_uploads" INI directive, which can be set to limit the
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 187b9bec30..9b384132fc 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -46,7 +46,11 @@ static void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC)
if (MyG(error_msg)) {
efree(MyG(error_msg));
}
- MyG(error_msg) = estrdup(mysql_err);
+ if(mysql_err && *mysql_err) {
+ MyG(error_msg) = estrdup(mysql_err);
+ } else {
+ MyG(error_msg) = NULL;
+ }
}
/* }}} */