phingofficial / phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.
https://www.phing.info
GNU Lesser General Public License v3.0
1.16k stars 319 forks source link

TstampTask impacted by deprecation #1682

Closed jawira closed 1 year ago

jawira commented 2 years ago

strftime() function was deprecated in PHP 8.1 and is going to be removed in PHP 9. The problem is that TstampTask relies a lot on this function.

As php.watch explains, \IntlDateFormatter can be used to replace strftime().

However, be aware that using \IntlDateFormatter will provoke a breaking change because the syntax used to declare a custom pattern is completely different.

<tstamp>
  <format property="DATE" pattern="%Y%m%d"/>
</tstamp>

Things like %Y%m%d are not going to work anymore because \IntlDateFormatter uses ICU syntax.

<tstamp>
  <format property="DATE" pattern="yyyyMMdd"/>
</tstamp>

Anyway, I'm more than willing to work in this issue, so let me know what do you think and if you need help with this :)

jawira commented 2 years ago

I was thinking about this. If TstampTask is updated, all old buildfiles will silently fail due to the new syntax, people will not understand why timestamps are not working anymore. Maybe it's a better idea to deprecate TstampTask (and display a warning) and create a new task -e.g. TimestampTask- which uses ICU syntax?

mrook commented 2 years ago

As @siad007 said on Slack, we'd prefer to keep the existing task. Can we (easily) convert non-ICU to ICU syntax? And warn the user that this is happening?

jawira commented 2 years ago

Hi, can you please check https://github.com/phingofficial/phing/pull/1683 ?