johannes Wed Feb 18 16:34:48 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/mysql/tests bug47438.phpt
Modified files:
/php-src NEWS
/php-src/ext/mysql php_mysql.c
Log:
MFH: Fix #47438 mysql_fetch_field ignores zero offse
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.501&r2=1.2027.2.547.2.965.2.502&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.501
php-src/NEWS:1.2027.2.547.2.965.2.502
--- php-src/NEWS:1.2027.2.547.2.965.2.501 Wed Feb 18 12:55:34 2009
+++ php-src/NEWS Wed Feb 18 16:34:47 2009
@@ -3,6 +3,7 @@
?? ??? 2009, PHP 5.3.0 Beta 2
- Upgraded bundled sqlite to version 3.6.11. (Scott)
+- Fixed bug #47438 (mysql_fetch_field ignores zero offset). (Johannes)
- Fixed bug #47398 (PDO_Firebird doesn't implements quoter correctly). (Felipe)
- Fixed bug #47390 (odbc_fetch_into - BC in php 5.3.0). (Felipe)
- Fixed bug #47343 (gc_collect_cycles causes a segfault when called within a
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.16.2.34&r2=1.213.2.6.2.16.2.35&diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.34
php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.35
--- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.34 Wed Dec 31 11:15:38 2008
+++ php-src/ext/mysql/php_mysql.c Wed Feb 18 16:34:47 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.34 2008/12/31 11:15:38 sebastian Exp $
*/
+/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.35 2009/02/18 16:34:47 johannes Exp $ */
/* TODO:
*
@@ -2318,7 +2318,7 @@
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- if (field) {
+ if (ZEND_NUM_ARGS() > 1) {
if (field<0 || field>=(int)mysql_num_fields(mysql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field
offset");
RETURN_FALSE;
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/bug47438.phpt?view=markup&rev=1.1
Index: php-src/ext/mysql/tests/bug47438.phpt
+++ php-src/ext/mysql/tests/bug47438.phpt
--TEST--
Bug #47438 mysql_fetch_field ignores zero offset
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once('connect.inc');
if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
mysql_connect("localhost", "root", "");
mysql_select_db("test");
mysql_query("DROP TABLE IF EXISTS test_47438");
mysql_query("CREATE TABLE test_47438 (a INT, b INT, c INT)");
mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)");
$result = mysql_query("SELECT * FROM test_47438");
mysql_field_seek($result, 1);
$i = 0;
while($i<mysql_num_fields($result))
{
$meta=mysql_fetch_field($result,$i);
echo $i . "." . $meta->name . "\n";
$i++;
}
mysql_query("DROP TABLE IF EXISTS test_47438");
?>
--EXPECT--
0.a
1.b
2.c
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php