Back to Stream class

Method applyContextToStream

public mixed
applyContextToStream
()
Applies the current context to the stream
Returns
  • mixed
Since
  • 1.7.0
Class: Stream
Project: Joomla

Method applyContextToStream - Source code

/**
 * Applies the current context to the stream
 *
 * Use this to change the values of the context after you've opened a stream
 *
 * @return  mixed
 *
 * @since   1.7.0
 */
public function applyContextToStream()
{
    $retval = false;
    if ($this->fh) {
        // Capture PHP errors
        $php_errormsg = 'Unknown error setting context option';
        $track_errors = ini_get('track_errors');
        ini_set('track_errors', true);
        $retval = @stream_context_set_option($this->fh, $this->contextOptions);
        if (!$retval) {
            $this->setError($php_errormsg);
        }
        // Restore error tracking to what it was before
        ini_set('track_errors', $track_errors);
    }
    return $retval;
}