self::MAX_LENGTH || 1 !== preg_match( '/\A[A-Za-z0-9_\-.~%=&+,\[\];:@!*\/]*\z/', $query ) ) { return null; } return $query; } /** Null clears it, so a direct REST call reads the real query string again. */ public static function set( ?string $query ): void { self::$forwarded = $query; } /** * What the signature covers: the proxied query when there is one, otherwise the request's own. * Null when the request carries a query this class would not sign; the caller must refuse * it, because WordPress still parses that query and a signature over '' would not cover it. */ public static function current(): ?string { return self::$forwarded ?? ServerVars::query_string(); } }