I need to know which function could perhaps disabled by my Hoster.
After a Domain Move my Hoster had set some function's to diabled for security reasons. I can talk to my Hoster Support to enable this function's but i need to know what function this are.
Warning: stream_set_blocking() expects parameter 1 to be resource, null given in
/var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php on line 265
Warning: stream_set_timeout() expects parameter 1 to be resource, null given in
/var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php on line 269
Fatal error:
Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""'
in /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php:386
Stack trace:
#0 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php(291):
Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array)
#1 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php(119):
Swift_Transport_AbstractSmtpTransport->_readGreeting()
#2 /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Mailer.php(80):
Swift_Transport_AbstractSmtpTransport->start()
#3 /var/www/web128032/html/includes/register1.php(203): Swift_Mailer->send(Object(Swift_Message))
#4 /var/www/web128032/html/index.php(42): include('/var/www/web128...')
#5 {main} thrown in /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 386
Check /var/www/web128032/html/Swift-4.2.2/lib/classes/Swift/Transport/StreamBuffer.php, line 265 to see what the first argument to the function call is, then find where the variable is assigned. There you'll find one of the functions producing a stream, like fopen or stream_socket_client (there are many various functions that may produce a stream). That function is what's failing.
echo function_exists('proc_open') ? "Yep, that will work" : "Sorry, that won't work";
Ouput was: "Sorry, that won't work"
Now i have to wait for my Hoster-Support then i can tell you if it now works. Ive seen many Posts an Question with the same Problem and Trace but no solutions (the most of them change the Hoster)
Anyway hier is the StreamBuffer.php: https://github.com/swiftmailer/swiftmai ... Buffer.php
I was not able to say for sure which Ressource will be filled in the func stream_set_blocking()
But i think it could be an disabled proc_open()
echo function_exists('stream_socket_client') ? "2 Yep, that will work" : "2 Sorry, that won't work";
$fp = stream_socket_client("tcp://www.example.com:80", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}
Output:
2 Sorry, that won't work
Warning: stream_socket_client() has been disabled for security reasons in /var/www/web128032/html/Backend/templates/admin.tpl on line 24
But i wonder why trows not this Errormessage to lines later?
That's because it only executes that branch if the function returned false (and you got null, as all disabled function implicitly return null). The code clearly does not expect the function to be disabled.
Ah yes ok i thought 0 == false. Ok know i unterstand.
Ok i wait for Request from my Support and will give feedback if solved or not (so can other participate from our Thread).
To solve this trace you have to enable mail() and stream_socket_client()
My Hoster did not enable proc_open() because of Security Risks! But Swiftmailer (i think so) have build a Fallback for this function.
Thank you Weirdan for your Help.
Edit: fsockopen() was also enabled earlier, not sure if swiftmailer works with zhis function.