Page 1 of 1

PHP 8.2

Posted: Thu Aug 17, 2023 8:41 am
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.

Re: PHP 8.2

Posted: Thu Aug 17, 2023 9:33 am
by burt
This is under discussion for a future release of Phoenix;

https://github.com/CE-PhoenixCart/PhoenixCart/issues/36

Re: PHP 8.2

Posted: Sat Aug 19, 2023 3:49 am
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.