Title: Call to undefined function str_getcsv()
Last modified: August 22, 2016

---

# Call to undefined function str_getcsv()

 *  Resolved [micb](https://wordpress.org/support/users/micb/)
 * (@micb)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/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!
 * [https://wordpress.org/plugins/postman-smtp/](https://wordpress.org/plugins/postman-smtp/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723813)
 * [str_getcsv()](http://php.net/str_getcsv) is a PHP 5.3 function. I use it to 
   [tokenize a comma-separated list of e-mail addresses](http://tiku.io/questions/955963/splitting-comma-separated-email-addresses-in-a-string-with-commas-in-quotes-in-p).
   I’ll have to find a replacement.
 * Thanks for the bug report!
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723883)
 * Fixed:
    Fatal error: Call to undefined function str_getcsv() => Replaced with
   PHP 4 function
 * Before I release a new version, would you please grab the development version
   and try it out.
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723895)
 * [https://downloads.wordpress.org/plugin/postman-smtp.zip](https://downloads.wordpress.org/plugin/postman-smtp.zip)
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723929)
 * I found [this page](http://stackoverflow.com/questions/23238617/php-fatal-error-declaration-of-zend-stdlib-arrayobjectoffsetget)
   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..
 *  Thread Starter [micb](https://wordpress.org/support/users/micb/)
 * (@micb)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723940)
 * 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…
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723964)
 * .. 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 );
       }
       ```
   
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723966)
 * I thought for sure you were going to run into
 *  `Fatal error: Class 'ArrayObject' not found`
 * But 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.
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723967)
 * 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.
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5723983)
 * 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.
 *  Plugin Author [Jason Hendriks](https://wordpress.org/support/users/jasonhendriks/)
 * (@jasonhendriks)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5724037)
 * Is this working for you now?
 *  Thread Starter [micb](https://wordpress.org/support/users/micb/)
 * (@micb)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5724070)
 * 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!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Call to undefined function str_getcsv()’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/postman-smtp_7c7b78.svg)
 * [Postman SMTP Mailer/Email Log](https://wordpress.org/plugins/postman-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/postman-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/postman-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/postman-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/postman-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/postman-smtp/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [micb](https://wordpress.org/support/users/micb/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/call-to-undefined-function-str_getcsv/#post-5724070)
 * Status: resolved