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

refactor: valid_date does not work in PHP 8.2 #6671

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Oct 12, 2022

Description
See #6170
See #6172 (comment)

bash-3.2$ ./phpunit tests/system/Validation/FormatRulesTest.php
PHPUnit 9.5.25 #StandWithUkraine

Runtime:       PHP 8.2.0-dev
Configuration: /Users/kenji/work/codeigniter/official/CodeIgniter4/phpunit.xml

...............................................................  63 / 193 ( 32%)
............................................................... 126 / 193 ( 65%)
............................................................... 189 / 193 ( 97%)
....                                                            193 / 193 (100%)

Time: 00:00.325, Memory: 14.00 MB

OK (193 tests, 193 assertions)

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@kenjis kenjis added the PHP 8.2 label Oct 12, 2022
@kenjis kenjis mentioned this pull request Oct 12, 2022
7 tasks
@kenjis kenjis added the refactor Pull requests that refactor code label Oct 12, 2022
@kenjis kenjis changed the title fix: valid_date does not work in PHP 8.2 refactor: valid_date does not work in PHP 8.2 Oct 12, 2022
@paulbalandan
Copy link
Member

Is there a case where $date is a DateTime instance yet $errors contains actual errors? If no, then can we remove the getLastErrors check?

@kenjis kenjis force-pushed the fix-valid_date-php82 branch from 436fd87 to 3bafbe6 Compare October 13, 2022 02:03
@kenjis
Copy link
Member Author

kenjis commented Oct 13, 2022

Is there a case where $date is a DateTime instance yet $errors contains actual errors?

Yes.

            [
                '1991-02-29',
                'Y-m-d',
                false,
            ],
            [
                'Thu, 31 Jun 2013 13:31:00',
                'D, d M Y H:i:s',
                false,
            ],
            [
                '2, 17, 2001',
                'j, n, Y',
                false,
            ],
            [
                '09-42-25, 12-00-17',
                'h-i-s, j-m-y',
                false,
            ],

@samsonasik samsonasik merged commit 4887c2a into codeigniter4:develop Oct 13, 2022
@samsonasik
Copy link
Member

Thank you @kenjis

@kenjis kenjis deleted the fix-valid_date-php82 branch October 13, 2022 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants