From: chrisw at networkm dot co dot uk
Operating system: Any
PHP version: Irrelevant
Package: Streams related
Bug Type: Feature/Change Request
Bug description:Provide direct access to socket errors without php_sockets
Description:
------------
Would it be possible to provide access to socket error codes/messages
without the
need to import the underlying socket into php_sockets?
It is often desirable to access the error information when a socket
operation
fails, and currently this is only possible via socket_import_stream, and
subsequent calls to socket_last_error/socket_strerror. This is only
possible if
php_sockets is available to the PHP installation, which is frequently not
the
case.
Test script:
---------------
<?php
$socket = stream_socket_client('tcp://11.22.33.44:123');
if (fwrite($socket, 'some data') === false) {
$errCode = stream_socket_error($socket);
echo 'Sending data failed: Socket error #'.$errCode;
}
Expected result:
----------------
Sending data failed: Socket error #<error code>
Actual result:
--------------
Fatal error - stream_socket_error or an equivalent function does not exist
--
Edit bug report at https://bugs.php.net/bug.php?id=63793&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63793&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63793&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63793&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63793&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63793&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63793&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63793&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63793&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63793&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63793&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63793&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63793&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63793&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63793&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63793&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63793&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63793&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63793&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63793&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63793&r=mysqlcfg