PHP 4.0 Bug #6559 Updated: yp_first() and yp_next() results handled wrong in ext/yp/yp.c
| From: | ohrn@php.net | Date: | Sun, 18 Mar 2001 22:05:11 +0000 |
| Subject: | PHP 4.0 Bug #6559 Updated: yp_first() and yp_next() results handled wrong in ext/yp/yp.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49302@lists.php.net to get a copy of this message | ||
ID: 6559
Updated by: ohrn
Reported By: gert@gerts.net
Old-Status: Open
Status: Closed
Bug Type: YP/NIS related
Assigned To:
Comments:
This depends on the data you put in the map in the first place. Properly created maps do not include
linebreaks.
It's not up to PHP to second guess the administrator of the YP domain. :)
Previous Comments:
---------------------------------------------------------------------------
[2000-09-05 14:31:58] gert@gerts.net
The key/value pairs that libnsl's yp_first/yp_next return contain
a trailing NEWLINE as per NIS specs. These NEWLINEs are
not chopped off before returning the key/value pair to the users's PHP
code. Hence you end up with newlines in PHP hashes.
Below is the context diff for the fix.
regards,
Gert
*** yp.c.orig Mon Jun 5 21:47:45 2000
--- yp.c Tue Sep 5 19:37:54 2000
***************
*** 151,156 ****
--- 151,158 ----
RETURN_FALSE;
}
array_init(return_value);
+ outkey[outkeylen] = 0;
+ outval[outvallen] = 0;
add_assoc_string(return_value,"key",outkey,1);
add_assoc_string(return_value,"value",outval,1);
}
***************
*** 175,180 ****
--- 177,184 ----
RETURN_FALSE;
}
+ outkey[outkeylen] = 0;
+ outval[outvallen] = 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=6559&edit=2