PHP 4.0 Bug #8041 Updated: yp_first and yp_next Return Different Array Formats
| From: | ohrn@php.net | Date: | Sun, 18 Mar 2001 22:22:23 +0000 |
| Subject: | PHP 4.0 Bug #8041 Updated: yp_first and yp_next Return Different Array Formats | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49303@lists.php.net to get a copy of this message | ||
ID: 8041
Updated by: ohrn
Reported By: jalessio@stoic.net
Old-Status: Open
Status: Closed
Bug Type: YP/NIS related
Assigned To:
Comments:
Fixed in CVS.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-29 21:05:55] jalessio@stoic.net
The output of the yp_first function and the yp_next function return different types of arrays. These
two functions are fetching the same information yet returning them in an inconsistent format.
yp_first returns an array as such when output with print_r:
Array
(
[key] => d264
[value] => hal:/export/&
)
and yp_next returns an array like this:
Array
(
[d273] => squash:/export/&
)
The result of yp_next if much more intuitive and useful. In any case, a consistent result from these
two functions would be nicer. Below is the context diff for the fix on "ext/yp/yp.c":
NOTE: This also incorporates the fix for BUG #6559
*** yp.c Wed Nov 29 18:01:34 2000
--- yp.c.fixed Wed Nov 29 18:01:08 2000
***************
*** 150,158 ****
if(yp_first((*domain)->value.str.val,(*map)->value.str.val,&outkey,&outkeylen,&outval,&outvallen))
{
RETURN_FALSE;
}
array_init(return_value);
! add_assoc_string(return_value,"key",outkey,1);
! add_assoc_string(return_value,"value",outval,1);
}
/* }}} */
--- 150,159 ----
if(yp_first((*domain)->value.str.val,(*map)->value.str.val,&outkey,&outkeylen,&outval,&outvallen))
{
RETURN_FALSE;
}
+ outval[outvallen] = 0;
+ outkey[outkeylen] = 0;
array_init(return_value);
! add_assoc_string(return_value,outkey,outval,1);
}
/* }}} */
***************
*** 175,180 ****
--- 176,183 ----
RETURN_FALSE;
}
+ outval[outvallen] = 0;
+ outkey[outkeylen] = 0;
array_init(return_value);
add_assoc_string(return_value,outkey,outval,1);
}
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=8041&edit=2