Skip to content

Fix some deprecation warnings#64

Merged
kamilwylegala merged 11 commits intokamilwylegala:masterfrom
zumba:deprecation-warnings-fix
Jan 29, 2024
Merged

Fix some deprecation warnings#64
kamilwylegala merged 11 commits intokamilwylegala:masterfrom
zumba:deprecation-warnings-fix

Conversation

@diegosurita
Copy link
Copy Markdown
Contributor

  • Switch deprecated utf8_encode function to mb_convert_encoding function.
  • Fix PHP 8.1 deprecation warnings on Helper and FormHelper.
  • Hide strftime deprecation warning.
  • Fix preg_split deprecated null param limit on CakeResponse::checkNotModified

diegosurita and others added 9 commits January 18, 2024 11:57
- fix deprecation warning when Helper::_entityPath is null
- fix `strftime` function deprecation warning on FormHelper::_getDateTimeValue method

ref: ARCH-11
Since CakePHP 2 doesn't require the installation of `intl` PHP extension in it's documentation, I can't use the alternative `IntlDateFormatter::format` because it relies such extension.

ref: ARCH-13
ARCH-11: Fix PHP 8.1 deprecation warnings on Helper and FormHelper
ARCH-13: hide strftime deprecation warnings and remove deprecated utf8_encode function
- CakeResponse.php strotime() and preg_split() warnings
@diegosurita diegosurita force-pushed the deprecation-warnings-fix branch from 1009e3b to d3c0f5c Compare January 26, 2024 13:19
@diegosurita diegosurita marked this pull request as draft January 26, 2024 13:42
@diegosurita diegosurita marked this pull request as ready for review January 26, 2024 20:07
@diegosurita
Copy link
Copy Markdown
Contributor Author

I suggest adjust PHP Coding Standard to ignore silencing errors (@), because I had to silence the deprecation warnings from strftime function. The reason why I did that is the suggested alternatives in PHP's documentation are:

  • date function, but it ignores locale settings
  • IntlDateFormatter::format() that has a param $locale, but it depends on intl extension, which is not required by default by Cakephp 2

See: https://onlinephp.io?s=s7EvyCjg5eLlKk4tyclPTsxJ1fBxjg_x9HXVUVAvKIl3ClLXtAbJpyZn5CukJJakaqgXqesolGTmpmpogqTAEgEeAfGu_j7WSOrSckvi0_KLchNLNGDc5KJUkAEQe6wUgFb6oFlpoKkJIoDmAAA%2C&v=8.2.13

@kamilwylegala
Copy link
Copy Markdown
Owner

@diegosurita Thank you for this contribution.

Maybe ignoring CodeSniffer error via: https://stackoverflow.com/a/4306803 could work?

Regarding introducing Intl, a I don't think it's a bad idea. Requirements for locale version of time is important, I think we could require this extension.

Could you add comment to ignore error first? Then maybe let's investigate Intl extension option.

@kamilwylegala
Copy link
Copy Markdown
Owner

Thanks for adjusting the code. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants