WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] WP 3.9: Warning: strpos() expects parameter 1 to be string (27 posts)

  1. Andrew.Bloom
    Member
    Posted 4 months ago #

    Updated to WP 3.9 and am getting this error:

    Warning: strpos() expects parameter 1 to be string, array given in /public_html/wp-includes/shortcodes.php on line 193

    I researched a bit, and it seems to be a functions.php issue with blank space. But I do not have any blank space there.

    Is anyone else experiencing this issue?

    Thanks

  2. Hi Andrew,

    Have you first tried disabling all of your plugins?

  3. Andrew.Bloom
    Member
    Posted 4 months ago #

    I did, but it looks like the theme is the culprit.

    Is there any easy way to revert to 3.8.3?

  4. eugenealegiojo
    Member
    Posted 4 months ago #

    Have you tried to switched to another theme just to conclude that it's really a theme issue?

  5. Andrew.Bloom
    Member
    Posted 4 months ago #

    Yes, it was the theme.

    I have successfully reverted to 3.8.3 until the theme author fixes this issue.

  6. brandonlucius
    Member
    Posted 4 months ago #

    This is the same issue that I'mchaving, I guess I need to contact the theme author as well.

  7. Webstract Marketing
    Member
    Posted 4 months ago #

    I found a quick fix...

    On in /wp-includes/shortcodes.php on line 193

    Change:
    if ( false === strpos( $content, '[' ) ) {

    To:
    if ( false === strpos( (string) $content, '[' ) ) {

    Basically just cast the $content variable as a string

  8. brandonlucius
    Member
    Posted 4 months ago #

    Is this additional code that's added in WordPress 3.9? I want to test this code out, but I'm not seeing if ( false === strpos( $content, '[' ) ) { in in my shortcodes.php file.

  9. Webstract Marketing
    Member
    Posted 4 months ago #

  10. brandonlucius
    Member
    Posted 4 months ago #

    I went back to 3.8.3 when the issue occurred, so I see it will be there in 3.9 so that I can go ahead and make the changes.

  11. webbrewers
    Member
    Posted 4 months ago #

    Webstract Marketing - thanks, this fixed it. These auto updates are a pain in the ..... Can't really blame the theme makers - how are they supposed to keep up?

  12. danieldude
    Member
    Posted 4 months ago #

    im having the same issue it shows only in my contact us page where i added the buildin wordpress contact form maybe it has somthing to do with that?

  13. danieldude
    Member
    Posted 4 months ago #

    Change:
    if ( false === strpos( $content, '[' ) ) {

    To:
    if ( false === strpos( (string) $content, '[' ) ) {

    Basically just cast the $content variable as a string

    this didn't fix my issue for some reason

  14. danieldude
    Member
    Posted 4 months ago #

    ops.... never mind it worked! thanks!

  15. Flexer
    Member
    Posted 4 months ago #

    Thanks for the fix @Webstract Marketing. If you google the error you get tons of sites, must be a 3.9 bug.

    Wouldn't this fix be erased whenever we update wordpress? I was using TwentyTwelve and got this issue. Alterantively perhaps it will be fixed in the next update to 3.9.

  16. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 months ago #

    What theme?

    Also, what is the context here? What is the content of the post where this shows up at?

  17. Flexer
    Member
    Posted 4 months ago #

    The theme was twentytwelve child
    It was while embedding the Jetpack form. If you Google the error it looks like it is other Jetpack forms.

    Flexer

  18. clixbits
    Member
    Posted 3 months ago #

    Add my name to the list having the same issue with 3.9

  19. David Chandra Purnama
    Member
    Posted 3 months ago #

    After debugging for several minutes, I think i found the problem.

    In grunion-contact-form.php line 601.

    parse_content( $content )

    is used in: (line 508)
    __construct( $attributes, $content = null )

    where:

    $this->parse_content( $content );

    and the $content there is not passing the sanitation to make it a string.

    to solve this:
    simply change (line 593)

    $this->parse_content( $content );

    to

    $this->parse_content( $this->content );

    probably just small typo?

  20. Flexer
    Member
    Posted 3 months ago #

    Cool that worked.

    I previously opened a support ticket with JetPack and I'll update them with your solution turtlepod. It should go into future code so your solution does not get erased when JP gets an update.

    Thanks
    Daveed

  21. vaibhavathare
    Member
    Posted 3 months ago #

    Thanks Webstart Marketing

    I was able to edit the file using notepad++

    However i am not able to replace it in the wp-includes folder
    I am also no able the edit the file inside the folder itself.

    Can anyone please assist me as to how i can edit the shortcodes file

  22. Evan Herman
    Member
    Posted 3 months ago #

    Why are you nto able to edit the file? Are you getting an eror?

    My guess- read write permissions are incorrect

  23. vaibhavathare
    Member
    Posted 3 months ago #

    Interestingly it does not give any error message when i edit file in the wp-includes folder.

    While copying an edited file in the location it states "Cant copy this file in this location".

    I even changed the permission for the wp-includes folder to User - Read Write and Execute.

  24. WPfreak
    Member
    Posted 3 months ago #

    In the text editor after "add this form to my post", I simply deleted the text in this particular warning. The rest of the fields came out fine. You would only have trouble if you're creating dozens of contact forms (would be tedious)

    My form starts here:

    Give us some feedback. We do appreciate!
    Warning: strpos() expects parameter 1 to be string, array given in /home/..../wp-includes/shortcodes.php on line 193
    [contact-form][contact-field label... etc etc

  25. sem101
    Member
    Posted 3 months ago #

    I'm getting this warning in 3.9.1. I have disabled all warnings for now. But what is the fix for shortcodes? The warning shows up on ANY page I have a shortcode on.

    PHP is 5.4 cannnot be changed.

    Do not not edit core php files.

  26. Ledez
    Member
    Posted 1 month ago #

    if ( false === strpos( (string) $content, '[' ) ) {

    Can someone help? warning gone, but now layer slider is gone.

  27. Tonibcreative
    Member
    Posted 1 month ago #

    Webstract Marketing YOU ARE A FRICKEN GODSEND THANK YOU

Topic Closed

This topic has been closed to new replies.

About this Topic