Skip to content

Commit

Permalink
Fix Intl Grapheme PCRE_VERSION comparison when the version has a time…
Browse files Browse the repository at this point in the history
…stamp

PCRE_VERSION constant might (or always) contains the date, as in: `MAJOR.MINOR Y-m-d`, or `10.35 2020-05-09`, refer to https://www.php.net/manual/en/pcre.constants.php

This PR fixes the version compare to account for the date, according to these tests:

- Before, notice that `10.35 2020-05-09` is considered lower than `8.32`: https://3v4l.org/imMSe#v8.0.10
- After: https://3v4l.org/IfSJi#v8.0.10
  • Loading branch information
Luc45 authored and nicolas-grekas committed Oct 26, 2021
1 parent 16880ba commit 5911fe4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Grapheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Polyfill\Intl\Grapheme;

\define('SYMFONY_GRAPHEME_CLUSTER_RX', \PCRE_VERSION >= '8.32' ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);
\define('SYMFONY_GRAPHEME_CLUSTER_RX', (float) \PCRE_VERSION >= 8.32 ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);

/**
* Partial intl implementation in pure PHP.
Expand Down

0 comments on commit 5911fe4

Please sign in to comment.