Codeception / Codeception/AspectMock

Error when mocking built-in function with pass-by-reference argument and argument with default value (PHP 8)

Đang mở
#201 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
784
Fork
132
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

This is for AspectMock 4.1.1.

During our migration from PHP 7.4 to PHP 8.1, we've encountered this pattern a few times:

When our PHP-Unit tests mock a PHP built-in function that has at least one argument passed by reference and one argument with a default value, the mock fails with the error `ParseError: syntax error, unexpected token "=", expecting ")"`.

The stack track looks like this:

```
/tmp/flockoipmSG:4
/petabox/www/common/vendor/codeception/aspect-mock/src/AspectMock/Core/Mocker.php:275
/petabox/www/common/vendor/codeception/aspect-mock/src/AspectMock/Core/Registry.php:38
/petabox/www/common/vendor/codeception/aspect-mock/src/AspectMock/Test.php:248
```

Examining the temporary file reveals the problem:
```
$ cat /tmp/flockoipmSG

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.