Title: Array to String Conversion Notice
Last modified: January 24, 2020

---

# Array to String Conversion Notice

 *  [Tessa Watkins](https://wordpress.org/support/users/tessachu/)
 * (@tessachu)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/array-to-string-conversion-notice/)
 * There’s something up with one of your shortcodes that’s causing this PHP notice
   to be littered all throughout my debug.log file.
 * The notice I’m seeing in my log is:
    `[24-Jan-2020 17:14:35 UTC] PHP Notice: 
   Array to string conversion in D:\home\site\wwwroot\wp-includes\shortcodes.php
   on line 325`
 * As you can see, that is a WP core file. I’ve modified it so I could identify 
   which shortcode was triggering it.
 * I modified this line in shortcodes.php (because this is the one that was having
   the error):
    `$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr,
   $content, $tag ) . $m[6];`
 * To this:
 *     ```
       $output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
       	set_error_handler( function( $errno, $errstr, $errfile, $errline, $errcontext ) {
       	    // error was suppressed with the @-operator
       	    if ( 0 === error_reporting() ) { return false; }
       	    throw new ErrorException( $errstr, 0, $errno, $errfile, $errline );
       	});
       	try {
       		$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
       	} catch( ErrorException $e ) {
       		fc_debug_log( array(
       			//'error' => $e,
       			'message' => $e->getMessage(),
       			'function_name' => $shortcode_tags[ $tag ],
       			'attributes' => $attr,
       			//'content' => $content,
       			'tag' => $tag,
       			'm1' => $m[1],
       			'm6' => $m[6]
       		) );
       	}
       	restore_error_handler();
       ```
   
 * Elsewhere in the file, I have this function for logging to my debug.log file:
 *     ```
       function fc_debug_log($obj)
       {
           if (is_array($obj) || is_object($obj)) {
               error_log(print_r($obj, true));
           } else {
               error_log($obj);
           }
       }
       ```
   
 * Anyway, I was able to identify that it’s coming from your plugin because this
   is what it outputted whenever I got the array to string conversion error:
 *     ```
       [24-Jan-2020 17:14:35 UTC] PHP Notice:  Array to string conversion in D:\home\site\wwwroot\wp-includes\shortcodes.php on line 325
       [24-Jan-2020 17:14:35 UTC] Array
       (
           [message] => Array to string conversion
           [function_name] => Array
               (
                   [0] => Skyword_Shortcode Object
                       (
                       )
   
                   [1] => customfields_shortcode
               )
   
           [attributes] => 
           [tag] => cf
           [m1] => 
           [m6] => 
       )
       ```
   
 * Is there a reason why your function name is an array and not a string? Can you
   please update your plugin so it does not cause this notice in WP core? Thank 
   you.
    -  This topic was modified 6 years, 4 months ago by [Tessa Watkins](https://wordpress.org/support/users/tessachu/).

The topic ‘Array to String Conversion Notice’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/skyword-plugin.svg)
 * [Skyword XMLRPC publishing](https://wordpress.org/plugins/skyword-plugin/)
 * [Support Threads](https://wordpress.org/support/plugin/skyword-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/skyword-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/skyword-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/skyword-plugin/reviews/)

## Tags

 * [Array to String Conversion](https://wordpress.org/support/topic-tag/array-to-string-conversion/)

 * 0 replies
 * 1 participant
 * Last reply from: [Tessa Watkins](https://wordpress.org/support/users/tessachu/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/array-to-string-conversion-notice/)
 * Status: not resolved