WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Warning: Illegal string offset 'type' in esu-front-end-class.php

[Resolved] Warning: Illegal string offset 'type' in esu-front-end-class.php

  • rsnuverink
    Member

    @rsnuverink

    WordPress version: 3.5.1
    Plugin Name and version: Easy Sign Up 3.1.3

    I installed the Easy Sign Up plugin in the wp-content\plugins folder and followed the setup instructions, but I keep getting errors (see below). Even with the default WP Theme ‘Twenty Eleven’ and all other plugins deactivated. I’m not very familiair with php, so can you advice how I may be able to solve this issue?

    Regards, Remco

    Warning: Illegal string offset ‘type’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 108

    Warning: Illegal string offset ‘type’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 108

    Warning: Illegal string offset ‘id’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 110

    Warning: Illegal string offset ‘id’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 110

    Warning: Illegal string offset ‘id’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 112

    Warning: Illegal string offset ‘type’ in C:\xampp\htdocs\wordpress\wp-content\plugins\easy-sign-up\lib\esu-front-end-class.php on line 134

    http://wordpress.org/extend/plugins/easy-sign-up/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Greenweb
    Participant

    @greenweb

    My guess that you are running PHP 5.4 . This plugin is optimized for PHP 5.3x. As that is what 99% of my users have.

    Quick fix would be to change the version of PHP your web server is running. PHP 5.3 is still actively developed with the latest version was pushed out on 06-Jun-2013 http://www.php.net/ChangeLog-5.php#5.3.26

    WordPress minimum requirements are here: http://wordpress.org/about/requirements/

    I don’t know much about xampp but there should be a config file somewhere that you can edit to load the correct version of PHP. Have a look at their docs: http://www.apachefriends.org/en/faq-xampp.html

    rsnuverink
    Member

    @rsnuverink

    Thanks for your prompt reply.

    I’m using XAMPP 1.8.1 with PHP 5.4. Unfortunately downsizing de PHP version with XAMPP is not that easy. Maybe I’ll try it later, because I’m not sure which PHP version our hosting provider uses.

    Plugin Author Greenweb
    Participant

    @greenweb

    Almost every web hosts i have worked with will let you choose your version of PHP.

    Polymetis
    Member

    @polymetis

    Here’s a solution I found which does not require you to change your version of PHP (thank you to Boann at stackoverflow.com):

    The posted code is valid, but it expects the parameter $inputs to be an array. The “Illegal string offset” warning in the part $inputs[‘type’] means that the function is being passed a string instead of an array. (And then since a string offset is a number, ‘type’ is not suitable.)

    So in theory the problem lies elsewhere, with the caller of the code not providing a correct parameter.

    That said, this warning message is new to PHP 5.4. Old versions didn’t warn if this happened. They would silently convert ‘type’ to 0, then try to get character 0 (the first character) of the string. So if this code was supposed to work, that’s because abusing a string like this didn’t cause any complaints on PHP 5.3 and below. (A lot of old PHP code has experienced this problem after upgrading.)

    You might want to debug why the function is being given a string by examining the calling code, and find out what value it has by doing a var_dump($inputs); in the function. But if you just want to shut the warning up to make it behave like PHP 5.3, change the line to:

    if (is_array($inputs) && $inputs['type'] == 'attach') {"

    Plugin Author Greenweb
    Participant

    @greenweb

    Thanks for the research Polymetis!

    CorneliaCycling
    Member

    @corneliacycling

    I’m not a wordpress developer. However, I just tried Polymetis’ solution. I just took the php file that was referenced in the warnings and replaced the line at (or close to) the line 108. It helped to suppress all error messages but one (referencing line 135). This one didn’t look like it needed a replacement, but I’m not sure because I don’t really know what I’m doing. Maybe it’ll help other users if you could specify where exactly to replace the code and what piece of code to replace?

    Great plugin though, really liked it.

    nwdwp
    Participant

    @nwdwordpress

    This post should not be marked resolved, as CorneliaCycling has stated, what was proposed by Polymetis is only a partial fix.

    Still left with a final error to suppress > /<home>/<useraccount>/public_html/wp-content/plugins/easy-sign-up/lib/esu-front-end-class.php on line 135

    I am testing some coding and if I get it working I will post a resolution here, so this can officially be marked as resolved.

    Plugin Author Greenweb
    Participant

    @greenweb

    @nwdwordpress

    My guess that you are running PHP 5.4 . This plugin is optimized for PHP 5.3x. As that is what 99% of my users have.

    Plugin Author Greenweb
    Participant

    @greenweb

    Mod please close this topic

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Warning: Illegal string offset 'type' in esu-front-end-class.php’ is closed to new replies.