• Resolved dboulet

    (@dboulet)


    When changing the language dropdown for a post on the Add New Post screen, I noticed that the ajax response was producing this error:

    Uncaught TypeError: Cannot read property 'length' of undefined

    When investigating the response that was returned from the server, I noticed that it contained this:

    Fatal error: Call to a member function get_help_tabs() on a non-object in /wp-admin/includes/meta-boxes.php on line 765

    It looks like the error originates in the ajax action PHP function, post_lang_choice(), when it makes a call to page_attributes_meta_box(). Looks like in this context, the call to get_current_screen() within that function returns null.

    https://wordpress.org/plugins/polylang/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    I don’t have this issue on WP 4.2 + Polylang 1.7.3
    Could you change to a default theme and de-activate all your plugins?
    Then re-activate your theme and your other plugins one by one and check for a conflict.

    Thread Starter dboulet

    (@dboulet)

    Hi Chouby, thanks for getting back to me.

    I was able to recreate this bug on a fresh install of WP 4.2.1 and Polylang 1.7.3. I apologize, I previously reported that this error happens on the Add New Post screen, but since page_attributes_meta_box() is only called for hierarchical posts, it only happens when adding or editing a page.

    To reproduce the bug, make sure that you have at least 2 languages installed on a fresh site, and then change the language in the drop down while adding a new page. Watch the JS console for errors.

    Plugin Author Chouby

    (@chouby)

    I reproduce with the page. OK in 4.1.x and KO in 4.2.1
    I will look at this and come back to you.

    Plugin Author Chouby

    (@chouby)

    I just uploaded a development version (1.7.3.6) which should fix this error.
    https://downloads.wordpress.org/plugin/polylang.zip

    Thread Starter dboulet

    (@dboulet)

    Thanks, Chouby. That seems to fix the original problem, but I’m now seeing this error in the ajax response:

    Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in /wp-content/plugins/polylang/admin/admin-filters-post.php on line 230

    I think that you are maybe missing a call to ob_start().

    Plugin Author Chouby

    (@chouby)

    It’s rather that I forgot to remove the ob_end_clean (I used an output buffer which I don’t need anymore). It’s strange however that I don’t reproduce this error. Normally my setup should log every PHP errors. Maybe the PHP version. Nice that you catched this one too.
    I reuploaded a new dev version (1.7.3.8)
    https://downloads.wordpress.org/plugin/polylang.zip

    Thread Starter dboulet

    (@dboulet)

    This latest version looks good, I’m not getting any more errors. Thanks for all your work, Chouby.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘JavaScript error on post edit screen when changing language’ is closed to new replies.