Call to undefined function str_getcsv()
-
Hello,
I just installed this plugin following your instructions. When I try to send a test email, the following error shows up:
Fatal error: Call to undefined function str_getcsv() …/plugins/postman-smtp/Postman/OAuthSmtpEngine.php on line 111
No emails at all are sent from the web site any further.
Thanks in advance!
-
str_getcsv() is a PHP 5.3 function. I use it to tokenize a comma-separated list of e-mail addresses. I’ll have to find a replacement.
Thanks for the bug report!
Fixed:
Fatal error: Call to undefined function str_getcsv() => Replaced with PHP 4 functionBefore I release a new version, would you please grab the development version and try it out.
I found this page that says Zend Framework 2.3 requires PHP 5.3.23 or above.
I’ve installed PH 5.2.17 on my computer but it’s probably going to be a little while longer until I get a working version for your version of PHP..
Hi,
I just added the following lines on line 111 of file OAuthSmtpEngin.php:
if(!function_exists('str_getcsv')) { function str_getcsv($input, $delimiter = ',', $enclosure = '"') { if( ! preg_match("/[$enclosure]/", $input) ) { return (array)preg_replace(array("/^\\s*/", "/\\s*$/"), '', explode($delimiter, $input)); } $token = "##"; $token2 = "::"; //alternate tokens "3434", "3535", "%%"; $t1 = preg_replace(array("/\\\[$enclosure]/", "/$enclosure{2}/", "/[$enclosure]\\s*[$delimiter]\\s*[$enclosure]\\s*/", "/\\s*[$enclosure]\\s*/"), array($token2, $token2, $token, $token), trim(trim(trim($input), $enclosure))); $a = explode($token, $t1); foreach($a as $k=>$v) { if ( preg_match("/^{$delimiter}/", $v) || preg_match("/{$delimiter}$/", $v) ) { $a[$k] = trim($v, $delimiter); $a[$k] = preg_replace("/$delimiter/", "$token", $a[$k]); } } $a = explode($token, implode($token, $a)); return (array)preg_replace(array("/^\\s/", "/\\s$/", "/$token2/"), array('', '', $enclosure), $a); } }With this change I can send a test email to myself, but usual notifications from the platform are still not sent. Furthermore, my test emails still land in the SPAM folder…
.. that’s interesting. I guess you didn’t download my code, I did (more or less):
if(!function_exists('str_getcsv')) { $fh = fopen ( 'php://temp', 'r+' ); fwrite ( $fh, $email ); rewind ( $fh ); $t = fgetcsv ( $fh ); fclose ( $fh ); } else { $t = str_getcsv ( $email ); }I thought for sure you were going to run into
Fatal error: Class 'ArrayObject' not foundBut I guess your PHP has the SPL extension installed.. I added this check in AdminController.php as a warning:
public function create_admin_page() { // test features $sslRequirement = extension_loaded ( 'openssl' ); $splAutoloadRegisterRequirement = function_exists ( 'spl_autoload_register' ); $phpVersionRequirement = PHP_VERSION_ID >= 50300; $arrayObjectRequirement = class_exists ( 'ArrayObject' );So, if you have no more errors, and you can send a test e-mail to yourself, the question now is why do other notifications not get sent?
Question: In your test e-mail that you got, does your body say:
' - sent by Postman via internal engine'
or
' - sent by Postman via wp_mail()'I actually try to send mail TWICE in case wp_mail() failed…
Would you like to become a developer on the project, micb? I can give you write access to the repo.
I test with Contact Form 7 and the WordPress Lost Password function myself… maybe it’s plugin compatibility problem? What other ‘usual notifications’ are you talking about? I can download the plugins you’re using and try them in my dev environment.
Gah! >:-(
You can’t send mail (no-one can send mail) cuz there is a bug:
Notice: Undefined variable: authorizationToken in /Users/jasonhendriks/Documents/workspace-postman/PostmanSMTP/Postman/PostmanWpMail.php on line 27
Fatal error: Call to a member function save() on a non-object in /Users/jasonhendriks/Documents/workspace-postman/PostmanSMTP/Postman/PostmanWpMail.php on line 27
I’ll release 0.2.7 right away.
Is this working for you now?
Hi,
Thanks for the update. I took a simpler way, which also works for now for me. But I will keep in mind your plugin which looks great!
Thanks!
The topic ‘Call to undefined function str_getcsv()’ is closed to new replies.