Uncategorized

  • MySQL 5.7 made the JSON column real

    Storing JSON in a TEXT column has always worked and gives you nothing: no validation, no way to query inside it, and a full parse in the application…

  • with() eager loads now; load() does it afterwards

    Both solve the same N+1 problem and they apply at different moments, which decides whether the collection you already have can be fixed or has to be re-fetched.…

  • rest_api_init fires late, and registering early anyway

    rest_api_init only fires on a REST request, which is efficient and means anything registered there does not exist during a normal page load — including the route definitions…

  • The REST API in core, and the plugin it replaces

    4.7 shipped the content endpoints. What moving off the feature plugin involves, why authentication is still the unsolved half, and the read API every site now exposes.

  • Closure::call binds a closure without bindTo

    Running a closure in the scope of an object took two steps: bindTo() to produce a new closure, then invoking it. call() does both, and it is considerably…

  • PHP 7 replaced most fatals with an Error you can catch

    Calling a method on null used to end the request with a fatal that no handler could intercept, which is why every framework had a register_shutdown_function checking error_get_last().…

  • wp_remote_get returns an array or a WP_Error, never both

    The HTTP API returns a response array on success and a WP_Error on failure, and the two share no shape at all — so any code that reaches…

  • random_bytes and random_int are finally in core

    Generating a secure token used to mean openssl_random_pseudo_bytes() with its easily-ignored $strong out-parameter, or mcrypt_create_iv(), or a userland library working out which of those existed. PHP 7 put…

  • Map keeps insertion order and takes objects as keys

    A plain object as a lookup coerces every key to a string, so 1 and “1” collide, and an object key becomes the useless string [object Object]. Map…

  • WP_Error is not an exception and will not stop anything

    WP_Error is a return value. Creating one has no effect on control flow, so a function that builds one and does not return it has done nothing at…