Home  |  Linux  | Mysql  | PHP  | XML
From:steve at ssgreenberg dot name Date:Thu Aug 28 21:30:32 2008
Subject:#45944 [NEW]: fsockopen examples of argument passing do not conform to definition
From:             steve at ssgreenberg dot name
Operating system: Any
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  fsockopen examples of argument passing do not conform to definition

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 bug report at http://bugs.php.net/?id=45944&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45944&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45944&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45944&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45944&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45944&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45944&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45944&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45944&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45944&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45944&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45944&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45944&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45944&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45944&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45944&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45944&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45944&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45944&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45944&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45944&r=mysqlcfg

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