Home  |  Linux  | Mysql  | PHP  | XML
From:steve at ssgreenberg dot name Date:Thu Aug 28 23:25:54 2008
Subject:#45944 [Opn]: fsockopen examples of argument passing do not conform to definition
 ID:               45944
 User updated by:  steve at ssgreenberg dot name
 Reported By:      steve at ssgreenberg dot name
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Any
 PHP Version:      Irrelevant
 New Comment:

Perhaps I am just misreading the documentation.  

The description declares the argument as passed by reference, but I
should not use the & when I pass the argument.  Therefore the
documentation and the example without the & are correct.  The examples
with the & are incorrect.


Previous Comments:
------------------------------------------------------------------------

[2008-08-29 04:16:44] steve at ssgreenberg dot name

I just noticed that when I try pass by reference, I do get the
message:

Warning: Call-time pass-by-reference has been deprecated;

I don't know how I missed this.  So is the the description of fsockopen
at http://us.php.net/fsockopen incorrect?  Or what?
It is not clear from the explanation of the fix for Bug #24429.
what was actually fixed.

------------------------------------------------------------------------

[2008-08-29 03:30:32] steve at ssgreenberg dot name

Description:
------------
The description of fsockopen is:

resource fsockopen  ( string $hostname  [, int $port  [, int &$errno 
[, string &$errstr  [, float $timeout  ]]]] )

Example #1 shows:

$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);

Example #2 shows:

$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);

Most user supplied example contain the same error.  Only one user
supplied example before mine showed the correct argument passing:

$fp = fsockopen('status.icq.com', 80, &$errno, &$errstr, 8);

If there is no error when fsockopen is passed control, then the wrong
argument passing is not noticeable. I have not come up with an example
to force an error to see what would happen.

I am not sure how this bug report relates Bug #24429.

If passing arguments by reference is deprecated, then the examples may
be right and the description of the function may be wrong.

Reproduce code:
---------------
Examples of good and bad code supplied in the description.

Expected result:
----------------
If the arguments to fsockopen are passed correctly and there is an
operational error when fsockopen is called, then it will be possible to
tell the user what went wrong.  

Actual result:
--------------
If fsockopen incurs an error during its operation and the arguments for
recording the error are passed incorrectly, then seemingly unexplainable
behavior could result.  Probably no useful error message will be
available to explain the problem to the user.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45944&edit=1

Navigate in group php.doc.bugs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants