Title: Error PHP 5.4
Last modified: August 21, 2016

---

# Error PHP 5.4

 *  [gatocristiano](https://wordpress.org/support/users/gatocristiano/)
 * (@gatocristiano)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/error-php-54/)
 * I am receiving this error, maybe my hosting updated PHP to 5.4 recently…
 * Warning: Illegal string offset ‘menubar’ in /home4/carlosco/public_html/bajardepeso/
   wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 383
 * [https://wordpress.org/plugins/tinymce-advanced/](https://wordpress.org/plugins/tinymce-advanced/)

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

 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875280)
 * This error suggests that something is using the `'tiny_mce_before_init'` filter
   improperly. It passes an array, but the error is about it being a string.
 * If you can debug further, could you add a `var_dump( $init );` on the first line
   in `Tinymce_Advanced::mce_options()`.
 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875283)
 * Hi Andrew,
    I also had some trouble with this in my plugin. I think it may have
   been related to PHP 5.4 as well.
 * I ended up adding an if/else check to first see if the array elements were empty
   or not.
 *     ```
       $myMenubar = 'link unlink';
   
       if( empty($init['menubar']) || $init['menubar'] === '') {
           $init['menubar'] = $myMenubar;
       } else {
           $init['menubar'] = $init['menubar'].' '.$myMenubar;
       }
       ```
   
 * I’m not saying this will work in every case, but I’m 99.98% sure it’s working
   for me.
 * It can get a little tricky when working with arrays (you have to know what’s 
   going “in”, to know how to add your customizations).
 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875284)
 * [@josh](https://wordpress.org/support/users/josh/) yeah, that makes sense when
   you’re appending some settings. You need to check whether the array element is
   already set.
 * However in my case it just sets or overrides the previous value:
 *     ```
       function mce_options( $init ) {
         if ( ... ) {
           $init['menubar'] = true;
         }
         return $init;
       }
       ```
   
 * As far as I see the only way that would throw the above warning is if `$init`
   is a string. However that should never happen as it uses the `'tiny_mce_before_init'`
   filter that always passes an array…
 * I can probably add:
 *     ```
       if( ! is_array( $init ) ) {
         $init = array();
       }
       ```
   
 * But that will silence the underlying problem which is the improper use of the`'
   tiny_mce_before_init'` filter.
 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875286)
 * I just tested this in my dev site:
    1. WP trunk 2. PHP 5.5.9 3. All WP-debug 
   set to true 4. No other plugins 5. Default 2014 theme
 * I could not get any error notice. However, I did note when I added the menubar
   option; while it did display correctly; I was unable to un-check the option and
   remove the menubar.
 * Basically, once I enabled the option, the menubar stayed there until I deactivated
   the plugin.
 * Your code is like super-freaking optimized (that’s a good thing); still one or
   two pay-grades above mine 😉
 * But I don’t think the `#init['menubar']` will accept a parameter of `true`? I
   think it either has to be false (disabled) or a string of the layout you would
   like to use; for example `"tools table format view insert edit"`.
 * Taken from here:
    [http://www.tinymce.com/wiki.php/Configuration:menubar](http://www.tinymce.com/wiki.php/Configuration:menubar)
 * Could the parameter of `true` be what’s causing the erratic behavior where the
   menubar can’t removed?
 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875288)
 * [@josh](https://wordpress.org/support/users/josh/) it’s a bit more complicated.
   The `menubar` setting is used in three places: [https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L279](https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L279)
   [https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L427](https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L427)
   and [https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L503](https://github.com/tinymce/tinymce/blob/master/js/tinymce/themes/modern/theme.js#L503).
 * The first gets the actual menu items if it is a string, the other two just check
   if it is not `false`. So setting it to `true` would use the default menu items
   and enable it.
 * > I was unable to un-check the option and remove the menubar.
 * Hmm, that’s weird. It is a simple checkbox. If you get the time can you add `
   var_dump( $_POST );` at the top and see what’s being submitted when saving the
   settings. It should be in that array when checked and not in the array when unchecked.
 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875291)
 * You’re right 🙂 That makes sense. Thank you for the explanation Andrew. I really
   appreciate you taking the time to put those links together to show me.
 * Of course I’ll check the var_dump. Be back shortly.
 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years ago](https://wordpress.org/support/topic/error-php-54/#post-4875292)
 * You’re good, Andrew. It must have been something in my cache. I’m going to make
   a ‘cache-buster’ for development purposes in TiynMCE 🙂
 * To clarify (since I took the thread off topic slightly)… I cannot seem to replicate
   any error notices using PHP 5.5.9 on localhost.
 * If the OP would like to provide steps to replicate receiving the warning, I’ll
   be happy to dig further.
 * Thank you for all your help. It’s working fine.
 *  [badboymark](https://wordpress.org/support/users/badboymark/)
 * (@badboymark)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/error-php-54/#post-4875311)
 * Andrew, I’ve had the same issue with the tinymce-advanced plugin because my hosting
   service has done the same thing with the PHP setting.
    My PHP setting is 5.4 
   here and I get the same error from it. If there is a way to correct this in the
   WP dashboard in the editing error, how I do this? The plugin is currently deactivated
   because of this issue. Could you or someone please tell me how to fix this issue?
   Because the hosting provider PHP setting in the server is PHP 5.4 and that is
   what is causing the issue as previously mentioned above and in the previous post
   to this thread. Please respond soon. _**P.S If you did fix this problem, how 
   did you do it as I would like to know? Please fill me in tell me if there is 
   anything I need to do from my end.**_
 *  [badboymark](https://wordpress.org/support/users/badboymark/)
 * (@badboymark)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/error-php-54/#post-4875312)
 * **_Josh, Thank You as well also._**

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

The topic ‘Error PHP 5.4’ is closed to new replies.

 * ![](https://ps.w.org/tinymce-advanced/assets/icon-256x256.png?rev=971511)
 * [Advanced Editor Tools](https://wordpress.org/plugins/tinymce-advanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tinymce-advanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tinymce-advanced/)
 * [Active Topics](https://wordpress.org/support/plugin/tinymce-advanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tinymce-advanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tinymce-advanced/reviews/)

 * 9 replies
 * 4 participants
 * Last reply from: [badboymark](https://wordpress.org/support/users/badboymark/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/error-php-54/#post-4875312)
 * Status: not a support question