php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12345 Error in yp_match return value
Submitted: 2001-07-24 13:20 UTC Modified: 2007-04-04 19:05 UTC
Votes:17
Avg. Score:3.1 ± 1.3
Reproduced:7 of 10 (70.0%)
Same Version:12 (171.4%)
Same OS:9 (128.6%)
From: jmaziarz at mitre dot org Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.6 OS: Solaris 2.7
Private report: No CVE-ID: None
 [2001-07-24 13:20 UTC] jmaziarz at mitre dot org
After upgrading to PHP v4.0.6 from v4.0.5 this problem seems to have started. When using yp_match() the documentation states:

"yp_match() returns the value associated with the passed key out of the specified map or FALSE"

However, FALSE is *NOT* returned if the key does not exist. Instead, I get the warning:

"Warning: no such key in map in [my script] on line [my line]"

As a quick fix, I surpress the error with @yp_match(). Has the function changed or is the documentation wrong?

My config is as follows:
./configure  
--with-apxs=/afs/rcf/apps/apache/sun4x_57/1.3.20/bin/apxs 
--with-config-file-path=/afs/rcf/apps/apache/sun4x_57/1.3.20/conf
--prefix=/afs/rcf/apps/apache/sun4x_57/1.3.20 
--with-pgsql=/afs/rcf/apps/pgsql 
--with-imap=/afs/rcf/admin/local 
--with-ldap=/afs/rcf/admin/local 
--with-xml 
--without-mysql 
--enable-track-vars 
--enable-magic-quotes 
--enable-yp 
--enable-debug 
--disable-short-tags

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-17 10:48 UTC] lobbin@php.net
Changes were made between version 4.0.5 and 4.0.6 to display this warning.

However, the function still returns FALSE, and should work as before if warning is suppressed via @yp_match() or error_reporting()

R.
 [2002-01-07 02:22 UTC] lobbin@php.net
No feedback. Closed.
 [2002-10-16 09:14 UTC] tshort at cisco dot com
yp_match() returns the value correctly, but generates a warning on a "sucessful failure", meaning that a warning is generated when the match fails, and the return value is false (this is as of 4.2.3).

When there is no match, a warning should not be generated. This is the purpose of the call, to find or not find something.
 [2017-03-14 15:05 UTC] zaondjja at eelmail dot com
Is this still an issue?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 07:01:32 2024 UTC