cvs: php-src(PHP_5_1) /ext/mysqli mysqli_api.c /ext/mysqli/tests 013.phpt

From: Date: Wed, 30 Nov 2005 15:26:41 +0000
Subject: cvs: php-src(PHP_5_1) /ext/mysqli mysqli_api.c /ext/mysqli/tests 013.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-35519@lists.php.net to get a copy of this message
andrey Wed Nov 30 10:26:41 2005 EDT Modified files: (Branch: PHP_5_1) /php-src/ext/mysqli mysqli_api.c /php-src/ext/mysqli/tests 013.phpt Log: fix more leaks. handle better unknown type (4.1.x connected to 5.0.x incompatibility) http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.7&r2=1.118.2.8&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.7 php-src/ext/mysqli/mysqli_api.c:1.118.2.8 --- php-src/ext/mysqli/mysqli_api.c:1.118.2.7 Wed Nov 30 06:35:03 2005 +++ php-src/ext/mysqli/mysqli_api.c Wed Nov 30 10:26:39 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter <georg@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.118.2.7 2005/11/30 11:35:03 andrey Exp $ + $Id: mysqli_api.c,v 1.118.2.8 2005/11/30 15:26:39 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -345,6 +345,9 @@ bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; bind[ofs].length = &stmt->result.buf[ofs].buflen; break; + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Server returned unknown type %ld. Probably your client library is incompatible with the server version you use!", col_type); + break; } } @@ -354,9 +357,13 @@ if (rc) { efree(bind); efree(args); - /* dont close the statement or subsequent usage (for example ->execute()) will lead to crash */ - efree(stmt->result.buf); - efree(stmt->result.is_null); + /* dont close the statement or subsequent usage (for example ->execute()) will lead to crash */ + for (i=0; i < var_cnt ; i++) { + if (stmt->result.buf[i].val) + efree(stmt->result.buf[i].val); + } + efree(stmt->result.buf); + efree(stmt->result.is_null); RETURN_FALSE; } http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/013.phpt?r1=1.4&r2=1.4.2.1&ty=u Index: php-src/ext/mysqli/tests/013.phpt diff -u php-src/ext/mysqli/tests/013.phpt:1.4 php-src/ext/mysqli/tests/013.phpt:1.4.2.1 --- php-src/ext/mysqli/tests/013.phpt:1.4 Sat Dec 4 03:50:33 2004 +++ php-src/ext/mysqli/tests/013.phpt Wed Nov 30 10:26:41 2005 @@ -25,7 +25,7 @@ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); $c = array(0,0,0,0,0,0,0,0); - mysqli_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); + $b_res= mysqli_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); mysqli_execute($stmt); mysqli_fetch($stmt); mysqli_fetch($stmt); @@ -38,10 +38,15 @@ $test = ""; for ($i=0; $i < count($c); $i++) $test .= ($c[0] == $d[0]) ? "1" : "0"; - - var_dump($test); + if ($test == "11111111") + echo "ok"; + else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 && + mysqli_get_server_version($link) > 50000) + echo "error (4.1 library with 5.x server)"; + else + echo "error"; mysqli_close($link); ?> ---EXPECT-- -string(8) "11111111" +--EXPECTF-- +ok

« previous php.cvs (#35519) next »