php

  • wp_add_inline_script instead of wp_localize_script

    wp_localize_script() exists to pass translated strings to JavaScript and has been used for everything else because it was the only way to get data across. 4.5 added the…

  • wp_cache_get with the found flag

    A cached value of false and a cache miss both return false, so a lookup that legitimately caches “no result” re-queries on every request and the cache appears…

  • Batching a WP-CLI loop so it does not exhaust memory

    A command iterating every post accumulates objects in the query cache and the object cache, so a loop that works over 10,000 rows fails over 200,000 — and…

  • Negative string offsets read from the end

    Reading the last character of a string has been $s[strlen($s) – 1] for two decades, which computes the length to throw it away and reads badly next to…

  • Static analysis on a codebase that has never had any

    Four thousand errors on the first run is a number nobody can act on. Starting at level 0, ignoring by pattern, and raising the floor one level at…

  • rest_prepare_post to reshape a response

    Removing a field from a core endpoint, or renaming one, has no registration API — the filter on the prepared response is the only hook, and it runs…

  • The asset pipeline Laravel 5.4 shipped

    Elixir wrapped gulp, which wrapped everything else. Mix wraps webpack directly — and leaves the configuration reachable when the abstraction runs out.

  • API resources replaced the transformer package

    Shaping a model for JSON has meant a transformer library or toArray() on the model, and the second couples the wire format to the database columns — so…

  • Telescope does not exist yet; here is the query log

    Finding out what queries a request actually ran means either a package, a debug bar that changes the page, or the listener that has been in the framework…

  • Composer 1.4 made the platform check a real error

    Installing a package requiring a PHP version newer than the one running used to be a warning in some paths. Composer 1.4 tightened it, which surfaces a problem…