Re: By refernce in fsockopen()

From: Date: Wed, 18 Oct 2000 06:20:04 +0000
Subject: Re: By refernce in fsockopen()
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-35357@lists.php.net to get a copy of this message
On Tue, Oct 17, 2000 at 04:47:55PM -0500, Andrei Zmievski wrote: > On Tue, 17 Oct 2000, Colin Viebrock wrote: > > I'm wondering how (if at all) the passing-by-reference issue > > affects fsockopen(). > > > > Right now, I'm using the syntax: > > > > $socket = fsockopen($HOST, $PORT, &$err_num, &$err_msg, $timeout ); > > > > Should I drop the "&" from the third and fourth arguments from > > now on? > > Yes. I have a function where I want to return data in some parameters like fsockopen does. I wasn't sure how to do it, but it looks like fsockopen does it almost right. I think there is one problem with fsockopen: In one place it does: if (arg_count>2) { zval_dtor(*args[2]); ZVAL_LONG(*args[2],errno); } if (arg_count>3) { zval_dtor(*args[3]); ZVAL_STRING(*args[3],strerror(errno),1); } RETURN_FALSE; while in the AF_UNIX case: if(arg_count>2) (*args[2])->value.lval = errno; if(arg_count>3) { (*args[3])->value.str.val = estrdup(strerror(err no)); (*args[3])->value.str.len = strlen((*args[3])->v alue.str.val); } RETURN_FALSE; Stig

« previous php.dev (#35357) next »