Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some deprecation warnings #64

Merged
merged 11 commits into from
Jan 29, 2024

Conversation

diegosurita
Copy link
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
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
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
Owner

Thanks for adjusting the code. Merging.

@kamilwylegala kamilwylegala merged commit 32459b1 into kamilwylegala:master Jan 29, 2024
5 checks passed
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