Hei!

I found another little problem with streams today (in HEAD). The 
following script gives a nice assertion error:

<?php
$connection = @stream_socket_client( "tcp://dolly.ez.no:25", $errno, $errstr, 5 
);
stream_set_timeout( $connection, 5 );
echo fgets($connection, 512);
echo fgets($connection, 512);


gives:
220 power mailer
php: /dat/dev/php/php-6.0dev/main/streams/streams.c:1115: 
_php_stream_get_line: Assertion `bufstart.v != ((void *)0) || !grow_mode || 
stream->eof' failed.
Aborted

backtrace:
Program received signal SIGABRT, Aborted.
[Switching to Thread 1092242592 (LWP 21338)]
0x40f9a7c7 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0x40f9a7c7 in raise () from /lib/tls/libc.so.6
#1  0x40f9c06b in abort () from /lib/tls/libc.so.6
#2  0x40f93735 in __assert_fail () from /lib/tls/libc.so.6
#3  0x082ef4a8 in _php_stream_get_line (stream=0x8581b68, buf_type=6, buf={s = 
0x0, u = 0x0, v = 0x0}, maxlen=0, maxchars=512,
                    returned_len=0xbfffc91c) at 
/dat/dev/php/php-6.0dev/main/streams/streams.c:1115
#4  0x0824a094 in zif_fgets (ht=2, return_value=0x8572960, 
return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /dat/dev/php/php-6.0dev/ext/standard/file.c:1005
#5  0x08356c0a in zend_do_fcall_common_helper_SPEC (execute_data=0xbfffcb14) at 
zend_vm_execute.h:209
#6  0x0835c2a1 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xbfffcb14) at 
zend_vm_execute.h:1610
#7  0x08356762 in execute (op_array=0x85bee38) at zend_vm_execute.h:92
#8  0x0832ebbb in zend_execute_scripts (type=8, retval=0x0, file_count=3) at 
/dat/dev/php/php-6.0dev/Zend/zend.c:1595
#9  0x082d9981 in php_execute_script (primary_file=0xbfffef34) at 
/dat/dev/php/php-6.0dev/main/main.c:1861
#10 0x083aacb5 in main (argc=2, argv=0xbffff054) at 
/dat/dev/php/php-6.0dev/sapi/cli/php_cli.c:1089

(gdb) frame 3
#3  0x082ef4a8 in _php_stream_get_line (stream=0x8581b68, buf_type=6, buf={s = 
0x0, u = 0x0, v = 0x0}, maxlen=0, maxchars=512,
    returned_len=0xbfffc91c) at 
/dat/dev/php/php-6.0dev/main/streams/streams.c:1115
1115                    assert(bufstart.v != NULL || !grow_mode || stream->eof);
(gdb) print bufstart
$1 = {s = 0x0, u = 0x0, v = 0x0}
(gdb) print grow_mode
$2 = 1
(gdb) print *stream
$3 = {ops = 0x84a1160, abstract = 0x8578360, readfilters = {head = 0x0, tail = 
0x0, stream = 0x8581b68}, writefilters = {head = 0x0,
    tail = 0x0, stream = 0x8581b68}, wrapper = 0x0, wrapperthis = 0x0, 
wrapperdata = 0x0, fgetss_state = 0, is_persistent = 0,
  mode = "r+", '\0' <repeats 13 times>, rsrc_id = 5, in_free = 0, 
fclose_stdiocast = 0, stdiocast = 0x0, __exposed = 1, orig_path = 0x0,
  context = 0x8579308, flags = 0, input_encoding = 0x0, output_encoding = 0x0, 
position = 18, readbuf = {
    s = 0x85c6320 "220 power mailer\r\n", u = 0x85c6320, v = 0x85c6320}, 
readbuflen = 8192, readpos = 0, writepos = 0, chunk_size = 8192,
  eof = 0}


regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to