php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55165 Additional equal sign, misleading.
Submitted: 2011-07-09 09:55 UTC Modified: 2011-07-11 11:04 UTC
From: tamate at hotmail dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-07-09 09:55 UTC] tamate at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.socket-last-error%23Examples
---
Additional equal sign.

Test script:
---------------
Should be
if ($fp == false) {
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);
    
    die("Couldn't create socket: [$errorcode] $errormsg");
}
and not
if ($fp === false) {
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);
    
    die("Couldn't create socket: [$errorcode] $errormsg");
}

Expected result:
----------------
Using the old code, no error will be found, and thus, no error will be shown.

Actual result:
--------------
If $fp fails, error code with error message will be displayed.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-11 11:04 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 [2011-07-11 11:04 UTC] aharvey@php.net
Looks fine to me: socket_create() returns boolean false on error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 21:01:29 2024 UTC