PHP 8.2

Open to all! Ask other shopowners for help.
Post Reply
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

PHP 8.2

Post by Pierre_P »

Hi there

I need to confirm some changes to upcoming deprecated functions.
I'm sure a class can be created or date.php can be updated for replacing the strftime

Example

Code: Select all

    <?php // printf(MODULE_CONTENT_CARD_PRODUCTS_HEADING, strftime('%B')); ?>
  <h4><?php
      $dateTimeObj = new DateTime('now', new DateTimeZone(date_default_timezone_get()));
  printf(MODULE_CONTENT_CARD_PRODUCTS_HEADING, (IntlDateFormatter::formatObject($dateTimeObj, 'MMMM', date_default_timezone_get() )));
      ?></h4>
Though it checks out, am i heading in the correct way or something better to suggest?
I have like 22 places where strftime is used.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: PHP 8.2

Post by burt »

This is under discussion for a future release of Phoenix;

https://github.com/CE-PhoenixCart/PhoenixCart/issues/36
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: PHP 8.2

Post by ecartz »

I forget. What actually happens when you use strftime? Does it say function not found or something else?

If it's function not found and you have IntlDateFormatter, you can just use the polyfill that Burt linked in the issue. That's probably the easiest short term solution.

Longer term, I think that we'll switch to IntlDateFormatter and include the Symfony polyfill for that for those whose hosts don't have IntlDateFormatter installed.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply