|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10706 yp_next does not report the next entry in the map
Submitted: 2001-05-07 10:55 UTC Modified: 2007-04-04 19:43 UTC
From: rabellino at di dot unito dot it Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 4.0.5 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
46 + 41 = ?
Subscribe to this entry?

 [2001-05-07 10:55 UTC] rabellino at di dot unito dot 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



 // Code By Rabellino Sergio
 // Department of Computer Science of Torino - Italy


 $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 ?)

 // 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 ?)



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-11 17:24 UTC]
Can you try this with 4.1.1?
 [2002-02-02 06:42 UTC]
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".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 19:05:54 2022 UTC