Skip to content

Conversation

massa-man
Copy link
Contributor

@massa-man massa-man commented Jan 23, 2024

Description (*)

Fixes issue with saving customer in admin with date of birth set to empty

Fixed Issues (if relevant)

  1. Fixes Unable to save customer in admin console with DOB set to empty #3751

Manual testing scenarios (*)

  1. Open a customer record in Admin
  2. Leave the date of birth field in the "Account information" section empty and click "save and continue edit"
  3. The AJAX validation gets stuck, and the AJX server response shows a warning in php 7.4 and error in php 8.1

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added documentation Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* labels Jan 23, 2024
@sreichel
Copy link
Contributor

Please test this change/fix ... Shardj/zf1-future#402

@massa-man massa-man requested a review from addison74 January 25, 2024 20:22
kiatng
kiatng previously approved these changes Jan 26, 2024
@addison74
Copy link
Contributor

@massa-man - Maybe you should consider the proposal made by @sreichel.

@massa-man
Copy link
Contributor Author

massa-man commented Jan 26, 2024

@massa-man - Maybe you should consider the proposal made by @sreichel.

@addison74 - I have, see my comment in the Issue thread. While the update to Zend_Locale_Math_PhpMath would fix this issue, I still think we should merge this fix into the magento code, to avoid unnecessarily calling expensive code with an empty string. Zend_Locale is expensive, these simple lines of code will improve performance and avoid unnecessary CPU due to code like this in the filters:

        $filterInput = new Zend_Filter_LocalizedToNormalized([
            'date_format'   => $this->_dateFormat,
            'locale'        => $this->_locale
        ]);
        $filterInternal = new Zend_Filter_NormalizedToLocalized([
            'date_format'   => Varien_Date::DATE_INTERNAL_FORMAT,
            'locale'        => $this->_locale
        ]);

        $value = $filterInput->filter($value);
        $value = $filterInternal->filter($value);

@sreichel
Copy link
Contributor

sreichel commented Jan 26, 2024

to avoid unnecessarily calling expensive code

Yep. My suggestion was only to fix it in time.

@fballiano fballiano changed the title bugfix(validations): fix date and datetime filters with empty values Fixed Varien_Data_Form_Filter_Date::inputFilter() and Varien_Data_Form_Filter_Datetime::inputFilter() dealing with empty values Jan 27, 2024
@fballiano fballiano merged commit ecdf1e1 into OpenMage:main Jan 27, 2024
@massa-man massa-man deleted the fix-3751 branch January 27, 2024 15:29
@massa-man
Copy link
Contributor Author

Thanks @fballiano for merging. Any chance we can cherry pick this commit into v19 branch? Is v19 branch still being maintained for patches?

I have also been testing v19 on PHP 8 and found a few issues (especially in the recurring profiles module) that I am happy to provide fixes for if we can push them into v19.

@fballiano
Copy link

v19 is security patches only, we could backport a single one (this) but if we start re-backporting every bugfix we've like 200 to backport and it was voted to freeze v19 (still, security patches are ported anyway for another 2 years give or take)

@fballiano
Copy link

but if you've installed v19 via composer you could try to add a composer patch of this PR: https://patch-diff.githubusercontent.com/raw/OpenMage/magento-lts/pull/3752.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to save customer in admin console with DOB set to empty
6 participants