Bug #10706 Updated: yp_next does not report the next entry in the map
| From: | sander@php.net | Date: | Sat, 02 Feb 2002 11:42:11 +0000 |
| Subject: | Bug #10706 Updated: yp_next does not report the next entry in the map | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-78880@lists.php.net to get a copy of this message | ||
ID: 10706
Updated by: sander@php.net
Reported By: rabellino@di.unito.it
Status: Feedback
Bug Type: YP/NIS related
Operating System: Solaris
PHP Version: 4.0.5
New Comment:
No feedback was provided for this bug, so it is being suspended.
If you are able to provide the information that was requested,
please do so and change the status of the bug back to "Open".
Previous Comments:
------------------------------------------------------------------------
[2002-01-11 17:24:27] lobbin@php.net
Can you try this with 4.1.1?
------------------------------------------------------------------------
[2001-05-07 10:55:22] rabellino@di.unito.it
If I use the Key returned from yp_first or yp_next, on my systems
(Solaris 2.6/2.7/2.8 either sparc/Intel), the yp_next return every time
the same entry.
I've discovered, after some hours of debugging, that php add a CR at
the end of the key, so the keylength is bigger than the real keylength
of 1 char.
Stripping it, php is definitely happy.
I wrote some lines to show that... use them as you think better
Thanks.
<?php
// Code By Rabellino Sergio
// Department of Computer Science of Torino - Italy
// Rabellino@di.unito.it
echo"<PRE>";
$map="passwd.byname";
$domain = yp_get_default_domain();
echo "Map ".$map." for domain: " . $domain." is \n";
// Get the first entry from YP
$entry = yp_first($domain, $map);
// Extract key and value
$key = $entry ["key"];
$value = $entry ["value"];
// Print key and value
echo $key;
echo $value;
// Remove the CR at the end of the key ... (? Solaris requirement only
?)
$key=substr($key,0,strlen($key)-1);
// the start the cycle to get the others values
while( is_array($entry = yp_next ($domain, "passwd.byname", $key)) )
{
// Extract the value
$keyn = key ($entry);
// Print key and value
echo $keyn;
echo $entry[$keyn];
// Remove the CR at the end of the key ... (? Solaris requirement
only ?)
$key=substr($keyn,0,strlen($keyn)-1);
}
echo"</PRE>";
?>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=10706&edit=1