]> granicus.if.org Git - php/commitdiff
MFH: Fix mysql_fetch_* and tests after param parsing changes
authorJohannes Schlüter <johannes@php.net>
Mon, 1 Dec 2008 21:20:47 +0000 (21:20 +0000)
committerJohannes Schlüter <johannes@php.net>
Mon, 1 Dec 2008 21:20:47 +0000 (21:20 +0000)
ext/mysql/php_mysql.c
ext/mysql/tests/mysql_fetch_array.phpt
ext/mysql/tests/mysql_fetch_assoc.phpt
ext/mysql/tests/mysql_fetch_row.phpt

index b934c759279a9586b3fdd164dd932b46f9d0170c..b4a708d5ee3a799e37608d90d3a38abeaaeef7db 100644 (file)
@@ -1963,8 +1963,6 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
        } else
 #endif
        {
-               result_type = MYSQL_BOTH;
-
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &result_type) == FAILURE) {
                        return;
                }
@@ -2109,7 +2107,7 @@ PHP_FUNCTION(mysql_fetch_row)
        MYSQL_RES               *result;
        zval                    *mysql_result;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &mysql_result) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &mysql_result) == FAILURE) {
                return;
        }
        ZEND_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, -1, "MySQL result", le_result);
@@ -2146,7 +2144,7 @@ PHP_FUNCTION(mysql_fetch_array)
        zval                    *mysql_result;
        long                    mode = MYSQLND_FETCH_BOTH;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &mysql_result, &mode) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &mysql_result, &mode) == FAILURE) {
                return;
        }
        ZEND_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, -1, "MySQL result", le_result);
@@ -2167,7 +2165,7 @@ PHP_FUNCTION(mysql_fetch_assoc)
        MYSQL_RES               *result;
        zval                    *mysql_result;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &mysql_result) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &mysql_result) == FAILURE) {
                return;
        }
        ZEND_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, -1, "MySQL result", le_result);
index c3a70ea55c611b0300410d92203f6874c1ca60f8..729523514abd9f97858df3348878042caf80e664 100644 (file)
@@ -15,8 +15,8 @@ $link   = NULL;
 if (NULL !== ($tmp = @mysql_fetch_array()))
        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
-if (false !== ($tmp = @mysql_fetch_array($link)))
-       printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (NULL != ($tmp = @mysql_fetch_array($link)))
+       printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
 require('table.inc');
 if (!$res = mysql_query("SELECT * FROM test ORDER BY id LIMIT 5", $link)) {
index 172917b6fd146b18dafd74cde3d479b7d8cab44d..4479a2ab3e8e07c73631add6a23ca8d6bde185c6 100644 (file)
@@ -17,8 +17,8 @@ $link   = NULL;
 if (!is_null($tmp = @mysql_fetch_assoc()))
        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
-if (false !== ($tmp = @mysql_fetch_assoc($link)))
-       printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (NULL !== ($tmp = @mysql_fetch_assoc($link)))
+       printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
 require('table.inc');
 if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) {
@@ -135,4 +135,4 @@ array(5) {
   [u"_foo"]=>
   NULL
 }
-done!
\ No newline at end of file
+done!
index 797e7ba1c8ff03449dabdef30749f3c516a231f4..d9fff217add3c448dedf8acca10d7753c7b62ef7 100644 (file)
@@ -15,8 +15,8 @@ $link   = NULL;
 if (!is_null($tmp = @mysql_fetch_row()))
        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
-if (false !== ($tmp = @mysql_fetch_row($link)))
-       printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (NULL !== ($tmp = @mysql_fetch_row($link)))
+       printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
 require('table.inc');
 if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) {