bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.65k stars 447 forks source link

SMTP class question #1277

Open iFlash opened 5 months ago

iFlash commented 5 months ago

In the SMTP class' send method, there is the following bit:

if (!$mock) {
    $socket=&$this->socket;
    $socket=@stream_socket_client($this->host.':'.$this->port,
        $errno,$errstr,ini_get('default_socket_timeout'),
        STREAM_CLIENT_CONNECT,$this->context);
        ...
        ...
ikkez commented 5 months ago

What is the question?

iFlash commented 5 months ago

That's odd – there used to be a question which was:

$socket is assigned a value and then, in the next line, assigned the result of the stream_socket_client call. What I don't understand: Why assign it the address of this->socket first if it's not used? Maybe my understanding lacks here, sorry.

pauljherring commented 5 months ago

What is the question?

It got edited out.

image

image

KOTRET commented 5 months ago

The first assignment sets the variable as a reference to this->socket and the following assignment sets a new variable content (to both).