fix(pay): break enqueue cycle that exhausted memory on the post editor

aksrt_icon_picker_assets() registers the icon-picker script as depending on
the caller's handle, so passing 'aksrt-pay-meta-box' already creates the
edge aksrt-icon-picker -> aksrt-pay-meta-box. Declaring the reverse on the
script and style closed a cycle, and WP_Dependencies' recursive resolver
never terminated, taking down every post editor and edit.php request.

Drop the reverse edge so the picker depends on the pay-meta script, not the
other way round, and contract-lock the direction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 20:40:30 +08:00
co-authored by Claude Sonnet 4.6
parent b94c820361
commit 592bfb4fa2
2 changed files with 13 additions and 2 deletions
@@ -148,6 +148,15 @@ test('the post editor resource row mirrors the reference seven fields with icon
assert.equal(reindex('downloads', 'aksrt_pay[video_episode][1][title]', 9), 'aksrt_pay[video_episode][1][title]');
assert.match(setup, /'icon' => \['type' => 'string'\]/);
// The icon picker registers itself as depending on the caller's handle, so the
// pay-meta script must NOT declare the icon-picker handle back: that cycle makes
// WP_Dependencies recurse until memory is exhausted on every post editor load.
const picker = read('inc/helpers/aksrt-icon-picker.php');
assert.match(picker, /array_merge\(\['jquery', 'aksrt-svg-sprite'\], \$deps\)/);
assert.match(meta, /aksrt_icon_picker_assets\(\['aksrt-pay-meta-box'\]\)/);
const payScript = meta.match(/wp_enqueue_script\('aksrt-pay-meta-box',[^\n]*\)/)[0];
assert.doesNotMatch(payScript, /aksrt-icon-picker/);
});
test('front submit paid-content prices and switch use the reference alignment rules', () => {