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
+4 -2
View File
@@ -43,15 +43,17 @@ class ResourceMetaBox {
wp_enqueue_media();
if (function_exists('aksrt_icon_picker_assets')) {
// Declares aksrt-icon-picker -> aksrt-pay-meta-box; the reverse edge
// must not be added here or WP's resolver recurses until OOM.
aksrt_icon_picker_assets(['aksrt-pay-meta-box']);
}
$css = AKSRT_DIR . '/assets/css/admin/pay-meta-box.css';
$js = AKSRT_DIR . '/assets/js/admin-pay-meta-box.js';
if (is_file($css)) {
wp_enqueue_style('aksrt-pay-meta-box', AKSRT_URI . '/assets/css/admin/pay-meta-box.css', ['aksrt-icon-picker'], (string) filemtime($css));
wp_enqueue_style('aksrt-pay-meta-box', AKSRT_URI . '/assets/css/admin/pay-meta-box.css', ['aksrt-font-awesome'], (string) filemtime($css));
}
if (is_file($js)) {
wp_enqueue_script('aksrt-pay-meta-box', AKSRT_URI . '/assets/js/admin-pay-meta-box.js', ['aksrt-icon-picker'], (string) filemtime($js), true);
wp_enqueue_script('aksrt-pay-meta-box', AKSRT_URI . '/assets/js/admin-pay-meta-box.js', [], (string) filemtime($js), true);
}
wp_localize_script('aksrt-pay-meta-box', 'aksrtPayMetaBox', [
'buttonClasses' => DomainModel::DOWNLOAD_BUTTON_CLASSES,