From:             
Operating system: *
PHP version:      5.3.3
Package:          Streams related
Bug Type:         Bug
Bug description:the notification callback method never gets call when using 
socket streams 

Description:
------------
At least when the context is set to 'tcp' and the socket is opened with
stream_socket_client, the callback method defined with the notification
parameters of stream_context_set_params never get called. 



And the current documentation is pointless regarding which wrapper actually
support the notifications. 

As far as I can see ftp and http wrappers support it but tcp socket (or
even file://) don't.



Callback notification function is the way to perform efficient and advanced
monitoring on socket.

It should be invoked for the following events:

STREAM_NOTIFY_RESOLVE Yes

STREAM_NOTIFY_CONNECT Yes

STREAM_NOTIFY_AUTH_REQUIRED No

STREAM_NOTIFY_MIME_TYPE_IS No

STREAM_NOTIFY_FILE_SIZE_IS No

STREAM_NOTIFY_REDIRECTED No

STREAM_NOTIFY_PROGRESS  Yes but optional 

STREAM_NOTIFY_COMPLETED Yes 

STREAM_NOTIFY_FAILURE Oh Yes

STREAM_NOTIFY_AUTH_RESULT No

STREAM_NOTIFY_SEVERITY_INFO Yes

STREAM_NOTIFY_SEVERITY_WARN Yes

STREAM_NOTIFY_SEVERITY_ERR Yes

Test script:
---------------
<?php



// define our callback method

function snc() { var_dump(func_get_args()); }



$ctx= stream_context_create();

stream_context_set_params($ctx, array("notification" => "snc"));

$uri= "htttp://www.example.net";

$socket = stream_socket_client($uri, $errno, $errstr, 0,
STREAM_CLIENT_CONNECT, $ctx); // snc should already have been called here
for at least connection and resolv.

$line =fgets($socket); // get one line.

fclose($socket); // close the connection. 

// Run the above lines and snc() never gets called.

Expected result:
----------------
1. Update documentation to let developers know the current state of the
callback support 

2. Have the callback method invoked when using socket streams for the
following events (where applicable).



Actual result:
--------------
The scn method never gets called.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52811&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52811&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52811&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52811&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52811&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52811&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52811&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52811&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52811&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52811&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52811&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52811&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52811&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52811&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52811&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52811&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52811&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52811&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52811&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52811&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52811&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52811&r=mysqlcfg

Reply via email to