#41489 [Opn->Asn]: stream_select does not work on ssl stream_socket_server (works in 5.2.1!) on 64b

2007-07-14 Thread jani
 ID:   41489
 Updated by:   [EMAIL PROTECTED]
 Reported By:  n dot escuder at intra-links dot com
-Status:   Open
+Status:   Assigned
 Bug Type: Streams related
 Operating System: Linux 2.6
 PHP Version:  5.2.3
 Assigned To:  iliaa


Previous Comments:


[2007-07-13 21:29:56] n dot escuder at intra-links dot com

I try without any certificat and the same problem appear.

I try launch server.php with php-5.2-dev and client with php-5.2.1 and
the same problem appear.

So i decide to lookup into the code. A strange result append i try to
explain :

code in ext/standard/streamsfuncs.c :

retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p);
printf("%d %d\n", max_fd, retval );
if (retval == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to select
[%d]: %s (max_fd=%d)",
errno, strerror(errno), max_fd);
RETURN_FALSE;
}
printf("%d\n", retval );
if (r_array != NULL) stream_array_from_fd_set(r_array, &rfds
TSRMLS_CC);
if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds
TSRMLS_CC);
if (e_array != NULL) stream_array_from_fd_set(e_array, &efds
TSRMLS_CC);
printf("%d\n", retval );
RETURN_LONG(retval);


As you can see i had three printf for debug :o)

I add an var_dump to the result of stream_select in server.php
The strange result i have after i launch client.php is :

3 1 -> First printf with max_fd and retval
1 -> Second printf with retval
0 -> Third printf with retval but the value as changed 
int(0) -> The var_dump in server.php

So the value change between the second and third printf ;o)

I hope this help



[2007-07-12 20:42:12] [EMAIL PROTECTED]

I just realized that of course I don't have this
cert/www/conf/ssl/server.pem here. But it can't be the cause..can it?




[2007-07-10 14:49:09] n dot escuder at intra-links dot com

I just retry with :

./configure --prefix=/usr --sysconfdir=/etc --disable-all
--enable-sockets --with-openssl --disable-cgi   

and the same append.



[2007-07-10 14:13:34] [EMAIL PROTECTED]

Did you try cutting the configure options to the bare minimum you need
for the test scripts to run and did you use --disable-all? If not, do
this.



[2007-07-10 12:36:36] n dot escuder at intra-links dot com

I did it with php5.2-200707101030

I ran with -n and the problems stay. ACCEPT never arrive.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41489

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


#41489 [Opn->Asn]: stream_select does not work on ssl stream_socket_server (works in 5.2.1!) on 64b

2007-06-30 Thread sniper
 ID:   41489
 Updated by:   [EMAIL PROTECTED]
 Reported By:  n dot escuder at intra-links dot com
-Status:   Open
+Status:   Assigned
 Bug Type: Streams related
 Operating System: Linux 2.6
 PHP Version:  5.2.3
-Assigned To:  
+Assigned To:  iliaa
 New Comment:

Ilia, can you check it out please?


Previous Comments:


[2007-06-29 19:59:04] n dot escuder at intra-links dot com

Ok now it's good on 32 bit plateform but not on 64 bit.

If i compile 32 bit version of PHP this works.

If i compile 64 bit version of PHP your patch don't work.



[2007-05-27 17:06:17] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.





[2007-05-24 13:09:30] n dot escuder at intra-links dot com

Description:

When creating an socket server in ssl mode stream_select don't work.

In PHP 5.2.1 all work fine the bug is in PHP 5.2.2.

Reproduce code:
---
server.php:

$options = array( "ssl" => array( "allow_self_signed" => true,
"verify_peer" => false, "local_cert" => "/www/conf/ssl/server.pem" ) );
$context = stream_context_create();
stream_context_set_option( $context, $options );

$s = stream_socket_server( "ssl://0.0.0.0:6310", $errno, $errstr,
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context );
while ( 1 ) {
   $read = array( $s );
   $wr = null;
   $ed = null;
   if ( stream_select( $read, $wr, $ed, 0, 500 ) > 0 ) {
  echo "ACCEPT\n";
   }
}

client.php:

$s = stream_socket_client( "ssl://localhost:6310" );
$s->write("toto\r\n\r\n");
sleep( 1 );


Expected result:

when running server.php we must go "ACCEPT" onto the screen.

Actual result:
--
nothing





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