Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
mail sending time out
  • Hi, see: https://github.com/fuel/docs/issues/287 I can't judge it is bug or no. So I just ask here. I want to know 'Is this bug? or not?'. On this timeout error showed, I never saw it was PHP timeout, because I set timeout in config file. (On the time, I forget to set 5 sec, I belived 30 sec. set. :D )
    'smtp' => array(
       'host'  => 'smtp.gmail.com',
       'port'  => 465,
       'username' => 'my-account@gmail.com',
       'password' => 'my-password',
       'timeout' => 5,
      ),
    
      /**
       * Newline
       */
      'newline' => "\r\n",
    

    I knew Google smtp nener return anything, then the socket frozen and over 30 seconds, it went to timeout on PKGPATH/email/classes/email/driver/smtp.php @ line 215, 'while($str = fgets($this->smtp_connection, 512))'. In smtp.php, seems timeout is set on just one part :
    /**
      * Connects to the given smtp and says hello to the other server.
      */
     protected function smtp_connect()
     {
      $this->smtp_connection = @fsockopen(
       $this->config['smtp']['host'],
       $this->config['smtp']['port'],
       $error_number,
       $error_string,
       $this->config['smtp']['timeout']
      );
    

    I google-d fsocketopen, this timeout for only connection. It never work for each read/write statement for socket. So I google-d more. And found a sample code with Japanese comments. So translate in English, it say:
    // connect by socket with HOST:PORT. (try TIMEOUT seconds)
    if ($fp = @fsockopen(HOST, PORT, err_no, err_str, TIMEOUT)) {
    
    // after connected, set timeout 5 seconds.
    socket_set_timeout($fp, 5);
    
    // get meta data of the socket
    $socket_data_arr = stream_get_meta_data($fp);
    
    // sending socket
    fputs($fp, $hoge);
    
    // when there are response, get them
    
    $buf = ""
    
    // if $socket_data_arr[time_out"] is true, sending is timeout
    
    while (!feof($fp) && !$socket_data_arr["time_out"]) {
    $buf .= fgets($fp, 1024);
    
    }
    
    fclose($fp);
    
    }
    

    I don't know this is correct handling, but I get idea to check timeout for socket. It is done by stream_set_timeout(), socket_set_timeout() is alias of this fanction. And check stmp.php, but no there both functions. So frozen at fgets() line, and reached php timeout. So, Is it bug? or not?
  • So the issue is that the configured timeout is not respected everywhere? Please update the issue, so @FrenkyNet can have a look at it.
  • I see. It is an issue.
  • I noticed you've created an issue for the fuel/docs repo. This is an issue for the email package, so I suggest you create it there if you want someone to have a look...
  • Oh, I see. But for green user like me, it is difficult to understand all FuelPHP stuff. Now to understand where and how I must report an issue, it takes a lot of time... Is there good page to see at glance about issue report? Maybe it is helpful to grow your FuelPHP comminity.
  • The different parts that make up FuelPHP have their own repository, each with their own issue tracker. The main github page ( https://github.com/fuel ) shows all repositories: docs, core, oil, orm, etc. See also http://fuelphp.com/contribute/issue-tracker...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion