ID: 8041
Updated by: ohrn
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: YP/NIS related
Assigned To: 
Comments:

Fixed in CVS.

Previous Comments:
---------------------------------------------------------------------------

[2000-11-29 21:05:55] [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to