Re: Streams segfault

From: Date: Fri, 23 Aug 2002 19:23:31 +0000
Subject: Re: Streams segfault
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-87363@lists.php.net to get a copy of this message
Yeah, that's why I am asking. In the ftp extension we have: if (ret != PHP_FTP_MOREDATA && ftp->closestream) { php_stream_close(ftp->stream); } if (ret == PHP_FTP_FAILED || php_stream_error(ftp->stream)) { php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf); } Seemed to me that this would turn into a problem once php_stream_error() is implemented. -Rasmus On Fri, 23 Aug 2002, Wez Furlong wrote: > No; once closed, a stream is pefree()d - just like a FILE*. > > Also, php_stream_error is currently a NOP: > > #define php_stream_error(stream) (0) > > It's a NOP because at the time, there was no code using the > equivalent stdio function; right now, it's only the ftp extension > that's using it. > I'll implement it this weekend, along with a couple of minor tweaks > to the filter system. > > --Wez. > > On 08/23/02, "Rasmus Lerdorf" <rasmus@php.net> wrote: > > Can we call php_stream_error() on a closed stream? > > > > On Fri, 23 Aug 2002, Wez Furlong wrote: > > > > > On 08/23/02, "Rasmus Lerdorf" <rasmus@lerdorf.ca> wrote: > > > > if (!n) { > > > > php_stream_close(stream); > > > > > > Closing the stream here leaves stream undefined. > > > > > > > efree(font); > > > > if (php_stream_eof(stream)) { > > > > > > And here it blows up. > > > > > > I've committed a fix for this by closing the stream a couple of > > > lines later. > > > I'm not sure why the code was like that; perhaps it was an error > > > on my part when converting it all to streams. > > > > > > Anyway, should be fixed now - thanks for pointing it out! > > > > > > --Wez. > > > > > > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.dev (#87363) next »