Skip to content

Runtime E_USER_DEPRECATED from #[\Deprecated] getSaveUrl() breaks admin & customer form pages #1066

Description

@fballiano

Summary

Mage_Adminhtml_Block_Widget_Form_Container::getSaveUrl() is marked #[\Deprecated] (since #1059), but it is still called from ~22 active call sites across core blocks and templates — including the container's own getFormHtml(). Under PHP 8.4 the #[\Deprecated] attribute raises E_USER_DEPRECATED at runtime, which Maho's error handler surfaces as a hard error on the affected pages:

Unknown error (16384): Method Mage_Adminhtml_Block_Widget_Form_Container::getSaveUrl() is deprecated
  in .../Mage/Adminhtml/Block/Widget/Form/Container.php on line 174

Root cause

#1059 ("Modernized @deprecated docblocks to #[\Deprecated] attributes") converted the pre-existing @deprecated docblock on getSaveUrl() into a #[\Deprecated] attribute. The docblock was a silent hint; the attribute fires at runtime. The method was deprecated in favour of getFormActionUrl(), but the callers were never migrated, so deprecating it at runtime breaks every page that renders one of those forms.

getSaveUrl() is a thin alias — it just returns getFormActionUrl() — so the migration is a mechanical, behaviour-preserving swap.

Impact

Any page that renders an admin form container or one of the templates below throws on PHP 8.4. Not limited to admin — customer/address/edit.phtml is frontend, so the customer address-edit page is hit too. Affected areas include: catalog product/category edit, sales order/invoice/shipment/creditmemo create, system config/cache/design, email templates, newsletter template/queue, tags, gift messages, revocation, feed manager, region translations, and customer address edit.

Call sites (getSaveUrl())

Blocks:

  • Mage/Adminhtml/Block/Widget/Form/Container.php:174 (getFormHtml() — the container render path)
  • Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php:44
  • Mage/Directory/Block/Adminhtml/Region/Edit/Tab/Translations/Form.php:54

Templates (adminhtml):

  • sales/order/create/form.phtml:18, sales/order/creditmemo/create/form.phtml:12, sales/order/invoice/create/form.phtml:12, sales/order/shipment/create/form.phtml:12, sales/order/view/giftmessage.phtml:17
  • catalog/category/edit/form.phtml:30, catalog/product/edit.phtml:32, catalog/product/edit/action/attribute.phtml:20, catalog/product/attribute/set/main.phtml:50
  • system/config/edit.phtml:17, system/cache/edit.phtml:16, system/design/edit.phtml:22, system/email/template/edit.phtml:88
  • newsletter/template/edit.phtml:31, newsletter/queue/edit.phtml:26
  • tag/edit/container.phtml:21, revocation/view.phtml:123, giftmessage/sales/order/view/items.phtml:15, maho/feedmanager/category/mapping.phtml:98

Templates (frontend):

  • customer/address/edit.phtml:23

Suggested fix

Either:

  1. Migrate all callers getSaveUrl()getFormActionUrl() (behaviour-preserving) and keep getSaveUrl() deprecated, or
  2. Drop the #[\Deprecated] attribute on getSaveUrl() until callers are migrated (it's still load-bearing across core).

Option 1 is the cleaner end state. Note the container render path (getFormHtml(), line 174) was already migrated as a one-line fix in PR #1062 to unblock the gift card edit page; the remaining call sites still need it.

Follow-up

Worth auditing the other @deprecated#[\Deprecated] conversions from #1059 for the same "deprecated but still self-called" pattern, since this likely isn't the only method affected.

Environment

  • PHP 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions