Luxeritas PHP8.3 Compatibility 調査まとめ(KI-04 / KI-05)

調査環境

sandbox 環境:

項目内容
OSWSL2 Ubuntu
RuntimeDocker Desktop
Toolwp-env
PHP8.3
WordPresslatest
ThemeLuxeritas fork
DBclean install
Plugins未投入

構成:

~/Claude/private/luxeritas/wp-sandbox

Phase 1: KI-04

現象

debug.log に大量 warning。

PHP Warning:
Trying to access array offset on null

発生箇所:

FileLine
functions.php53
functions.php67
functions.php85
functions.php92
functions.php226
functions.php245
inc/const.php17
inc/widget.php1803
inc/widget.php2245

root cause

原因

WP-CLI bootstrap 時の scope inheritance

詳細

WP-CLI は:

WP_CLI\Runner::load_wordpress()

内から:

require 'wp-settings.php'

を実行。

PHP の include/require は:

caller scope を継承

する。

そのため:

$_is['ssl'] = is_ssl();

等が:

$GLOBALS

ではなく、

load_wordpress() local scope

へ格納される。

後続 callback 側では:

global $_is;

により $GLOBALS['_is'] を参照。

しかし:

$GLOBALS['_is'] 未初期化

のため warning。


本質

これは:

PHP8.3 incompatibility

ではなく、

昔から存在していた bootstrap 前提

が、

wp-cli / Docker / CI

で顕在化したもの。


修正方針比較

Option A(採用)

global $luxe, $_is, $fchk, $default_set, $widget_concat, $awesome;

を:

inc/global-const.php

冒頭へ追加。


Option B(不採用)

各 warning 箇所を:

?? false
isset(...)

化。


採用理由

Option A は:

  • root cause 修正
  • 変更量最小
  • wp-cli 対応
  • PHP8.4 対応
  • CI / automation 対応
  • semantic preserve

を満たす。


修正結果

commit:

0e03890

結果:

  • debug.log clean
  • wp-cli warning 解消
  • Trying to access array offset on null 消滅

Phase 2: KI-05

現象

ブラウザ / Customizer 系で:

PHP Deprecated:
rawurlencode(): Passing null to parameter #1 ($string)

発生。

対象:

themes/luxeritas/inc/wpfunc.php:2696

対象コード

function thk_encode( $value ){
    return rawurlencode( thk_convert( $value ) );
}
function thk_convert( $value ){
    if( empty( $value ) ) return;
    if( stripos( $value, chr(0x00) ) !== false ) return;
    ...
    return $value;
}

発生経路

TOP / Customizer preview
→ sns-front.php
→ LinkedIn share button
→ thk_encode( '' )
→ thk_convert( '' )
→ return; (null)
→ rawurlencode( null )
→ PHP8.1+ Deprecated

発生条件

wp-sandbox clean install では:

blogdescription = ''

のため再現。


本質

今回の問題は:

thk_convert() は nullable

なのに、

thk_encode() が string 前提

で扱っている点。

つまり:

boundary contract mismatch


修正方針比較

Option A(採用)

return rawurlencode( thk_convert( $value ) ?? '' );

Option B(不採用)

return '';

へ変更。


Option C(不採用)

(string)

cast。


採用理由

Option A は:

  • boundary absorb
  • semantic preserve
  • nullable contract 維持
  • 最小 diff
  • rollback 容易
  • future PHP 対応

を満たす。


Option B を避けた理由

thk_convert() は:

  • sns-cache.php
  • compress.php
  • admin-func.php
  • blogcard-func.php

等から直接利用されている。

つまり:

null → ''

変更は、

意味論変更

となる可能性がある。


修正結果

commit:

8251c6b

結果:

  • debug.log clean
  • rawurlencode(null) 消滅
  • SNS template path 実行確認済
  • curl 200 OK
  • twitter / linkedin tag 出力確認済

AIレビュー比較

Gemini

傾向:

型整合性重視

提案:

thk_convert() は常に string を返すべき

OpenClaw + Codex/gpt-5.5

傾向:

semantic preserve

重視。

提案:

boundary absorb


最終採用方針

今回は:

既存巨大コードとの互換

を優先し、

caller boundary fix

を採用。


現在の状態

PHP8.3 clean install 環境で:

  • fatalなし
  • debug.log clean
  • wp-cli clean
  • SNS path clean
  • minimal fixes 完了
  • docs / PROGRESS / git 整理済

次フェーズ

次は:

real-world compatibility

確認。

候補:

  • 本番DB import
  • plugin restore
  • Customizer 実運用
  • cache/minify
  • async CSS
  • REST
  • wp-cli automation
  • PHP8.4 test

です。