Giter Site home page Giter Site logo

Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /[...]/wp-includes/formatting.php:1595 about wordpress-micropub HOT 3 CLOSED

janboddez avatar janboddez commented on June 12, 2024
Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /[...]/wp-includes/formatting.php:1595

from wordpress-micropub.

Comments (3)

janboddez avatar janboddez commented on June 12, 2024

Can be addressed like so (in mp_to_wp()):

if ( isset( $args['post_name'] ) ) {
  $args['post_name'] = sanitize_title( ((array) $args['post_name'])[0] );
}

Not too sure why I'm seeing this only now[.]

I mostly long-press links from my feed reader; in this case Indigenous does not set a title (and suggest_post_title() returns an empty string) and the error does not occur. In the rare occurrence that I use my mobile browsers actual share menu, it does fill out the page title, and I get the error.

from wordpress-micropub.

janboddez avatar janboddez commented on June 12, 2024

I just ran into this again and wondered why it worked on my other site. Turns out I had applied the workaround above ...

Am I the only one seeing this?

Tested with all plugins disabled except IndieAuth and Micropub and it happens all the time, and stops as soon as I apply the change above.

from wordpress-micropub.

janboddez avatar janboddez commented on June 12, 2024

Might be different for JSON vs. form requests? I seem to remember the spec saying JSON values should always be arrays. Either way, casting to an array and then grabbing the first item should work for both single strings and arrays with one or more (string) values.

from wordpress-micropub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.