php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60781 getprotobyname: returns FALSE, not -1
Submitted: 2012-01-17 15:54 UTC Modified: 2012-01-20 02:19 UTC
From: phpmpan at mpan dot pl Assigned: laruence (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phpmpan at mpan dot pl
New email:
PHP Version: OS:

 

 [2012-01-17 15:54 UTC] phpmpan at mpan dot pl
Description:
------------
---
From manual page: http://www.php.net/function.getprotobyname#refsect1-function.getprotobyname-returnvalues
---

Documentation says "-1 if the protocol is not found", but function returns `FALSE` if the protocol is not found.

Related to bug#60779 and similar bug#52662 for `getprotobynumber`.

Test script:
---------------
<?php
// Based on code from #60779
$protocol = 'BLA';
$get_prot = getprotobyname($protocol);
var_dump($get_prot);
?>

Expected result:
----------------
Return Values

Returns the protocol number or FALSE if the protocol is not found.

Actual result:
--------------
Return Values

Returns the protocol number or -1 if the protocol is not found.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-18 02:39 UTC] laruence at gmail dot com
this was introduced since 2002..
http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/basic_functions.c?
view=log&pathrev=98153
 [2012-01-20 02:19 UTC] laruence@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2012-01-20 02:19 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=9d7a3fff18b8491c6f6756d2b3975fa77a189cd2
Log: Fixed bug #60781 (getprotobyname: returns FALSE, not -1)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 02:00:01 2026 UTC