|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-03-18 17:22 UTC] ohrn@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 01:00:01 2025 UTC |
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); }