Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T16461 numericality spaces #16462

Merged
merged 17 commits into from
Nov 6, 2023
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
- id: setup-zephir-ext
name: Setup Zephir Extensions
run: |
echo "::set-output name=extensions::zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }}"
# echo "extensions=zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }}" >> "$GITHUB_ENV" # Need to change the templates to use this
echo "extensions=zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }}" >> "$GITHUB_OUTPUT"


# PHP CodeSniffer inspection
Expand Down Expand Up @@ -182,7 +181,7 @@ jobs:
$PhalconExtPath = "$(php-config --extension-dir)/phalcon.so"
}
echo "::set-output name=extension-path::$PhalconExtPath"
# echo "extension-path=$PhalconExtPath" >> "$GITHUB_ENV" # This needs to be checked, used below somehow
# echo "extension-path=$PhalconExtPath" >> "$GITHUB_OUTPUT"

- name: Creates build artifact with Phalcon extension
uses: ./.github/actions/pack-phalcon-ext
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [5.4.1](https://github.com/phalcon/cphalcon/releases/tag/v5.4.1) (xxxx-xx-xx)

### Changed

### Added

### Fixed

- Fixed `Phalcon\Filter\Validation\Validator\Numericality` to return false when input has spaces [#16461](https://github.com/phalcon/cphalcon/issues/16461)

### Removed

## [5.4.0](https://github.com/phalcon/cphalcon/releases/tag/v5.4.0) (2023-10-25)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Filter/Validation/Validator/Numericality.zep
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Numericality extends AbstractValidator
// Dump spaces in the string if we have any
let value = validation->getValue(field),
value = (string) value,
value = str_replace(" ", "", value),
// value = str_replace(" ", "", value),
pattern = "/((^[-]?[0-9,]+(\\.[0-9]+)?$)|(^[-]?[0-9.]+(,[0-9]+)?$))/";

if this->allowEmpty(field, value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private function getMixedExamples(): array
[1, true],
[123, true],
[123.45, true],
['1 234.56', true],
['1 234.56', false],
['1,234.56', true],
['1.23', true],
['1.123,56', true],
Expand All @@ -230,7 +230,7 @@ private function getMixedExamples(): array
[-1, true],
[-123, true],
[-123.45, true],
['-1 234.56', true],
['-1 234.56', false],
['-1,234.56', true],
['-1.23', true],
['-1.123,56', true],
Expand All @@ -241,6 +241,9 @@ private function getMixedExamples(): array
['-12,000', true],
['-12,0@0', false],
['-12,0@@0', false],
[' 1', false],
['1 ', false],
['1 1', false],
];
}
}