Skip to content

Commit

Permalink
Avoid "open_basedir restriction" error
Browse files Browse the repository at this point in the history
Fixes problem where email sending fails due to a web hoster restriction. By using `sys_get_temp_dir()` it's possible to use a different configured path from the unix default '/tmp'. <https://php.net/manual/en/function.tempnam.php#93256>
  • Loading branch information
GithubuserX committed Apr 14, 2018
1 parent 53ecb3c commit 9e0b83e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/class-wp-smime.php
Expand Up @@ -107,7 +107,7 @@ public static function pemToDer ( $pem_str ) {
* @return array|FALSE An array with two keys, `headers` and `message`, wherein the message is encrypted.
*/
public static function encrypt ( $message, $headers, $certificates ) {
$infile = tempnam( '/tmp', 'wp_email_' );
$infile = tempnam( sys_get_temp_dir(), 'wp_email_' );
$outfile = $infile . '.enc';

$plaintext = ( is_array( $headers ) ) ? implode( "\n", $headers ) : $headers;
Expand Down

0 comments on commit 9e0b83e

Please sign in to comment.