Skip to content

Commit dfd714b

Browse files
authored
Merge branch '5.x-dev' into dev-20125
2 parents 922b403 + 3943a17 commit dfd714b

775 files changed

Lines changed: 2886 additions & 1958 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
chmod 755 ./.github/scripts/*.sh
174174
./.github/scripts/build-package.sh $version
175175
shell: bash
176-
- uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b
176+
- uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd
177177
with:
178178
artifacts: "archives/matomo-${{ steps.tag.outputs.version }}.*,archives/piwik-${{ steps.tag.outputs.version }}.*"
179179
allowUpdates: ${{ steps.tag.outputs.update }}

composer.lock

Lines changed: 21 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Common.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
*/
2828
class Common
2929
{
30+
private const FLOAT_REGEX = "/^[-+]?((([0-9]+(_[0-9]+)*)|(([0-9]+(_[0-9]+)*)?\.([0-9]+(_[0-9]+)*))|(([0-9]+(_[0-9]+)*)\.([0-9]+(_[0-9]+)*)?))([eE][+-]?([0-9]+(_[0-9]+)*))?)$/";
31+
3032
// constants used to map the referrer type to an integer in the log_visit table
3133
public const REFERRER_TYPE_DIRECT_ENTRY = 1;
3234
public const REFERRER_TYPE_SEARCH_ENGINE = 2;
@@ -1085,6 +1087,26 @@ public static function forceDotAsSeparatorForDecimalPoint($value)
10851087
return str_replace(',', '.', $value);
10861088
}
10871089

1090+
/**
1091+
* Parses the given value as float and returns null if it cannot be represented as a PHP float.
1092+
*
1093+
* Supports the same string notations as PHP floats, including underscore notation.
1094+
*
1095+
* @param mixed $value
1096+
*/
1097+
public static function parseFloat($value): ?float
1098+
{
1099+
if (is_float($value) || is_int($value)) {
1100+
return (float)$value;
1101+
}
1102+
1103+
if (is_string($value) && preg_match(self::FLOAT_REGEX, $value)) {
1104+
return (float)str_replace('_', '', $value);
1105+
}
1106+
1107+
return null;
1108+
}
1109+
10881110
/**
10891111
* Sets outgoing header.
10901112
*

0 commit comments

Comments
 (0)