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

mb_http_input test is faild on Windows #14407

Open
youkidearitai opened this issue Jun 1, 2024 · 7 comments · May be fixed by #14454
Open

mb_http_input test is faild on Windows #14407

youkidearitai opened this issue Jun 1, 2024 · 7 comments · May be fixed by #14454

Comments

@youkidearitai
Copy link
Contributor

Description

The following code:

C:\php-sdk\php-src
+$ nmake test TESTS=ext/mbstring
... ommited ...

Resulted in this output:

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
mb_http_input() [C:\php-sdk\php-src\ext\mbstring\tests\mb_http_input.phpt]
mb_http_input() with pass encoding [C:\php-sdk\php-src\ext\mbstring\tests\mb_http_input_pass.phpt]
=====================================================================
NMAKE : fatal error U1077: 'C:\php-sdk\php-src\x64\Debug_TS\php.exe' : リターン コード '0x1'
Stop.

But I expected this output instead:
Test all passed in mbstring.

I got an error when I put --enable-cgi. At least, PHP 8.0 and master is failed.

config.nice.bat script

@echo off
cscript /nologo /e:jscript configure.js "--disable-all" "--enable-cli" "--enable-cgi" "--enable-debug" "--enable-mbstring" "--enable-intl" %*

mb_http_input.log


---- EXPECTED OUTPUT
ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
bool(false)
bool(false)
array(1) {
  [0]=>
  string(10) "ISO-8859-1"
}
string(10) "ISO-8859-1"
mb_http_input(): Argument #1 ($type) must be one of "G", "P", "C", "S", "I", or "L"
---- ACTUAL OUTPUT
ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
Æ�Eܸ�E123456789Æ�Eܸ�E«¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
bool(false)
bool(false)
array(1) {
  [0]=>
  string(10) "ISO-8859-1"
}
string(10) "ISO-8859-1"
mb_http_input(): Argument #1 ($type) must be one of "G", "P", "C", "S", "I", or "L"
---- FAILED

mb_http_input.diff

     ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
002+ Æ�Eܸ�E123456789Æ�Eܸ�E«¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
002- ÆüËܸì0123456789ÆüËܸ쥫¥¿¥«¥Ê¤Ò¤é¤¬¤Ê
     string(10) "ISO-8859-1"
     string(10) "ISO-8859-1"
     bool(false)
--

mb_http_input_pass.log


---- EXPECTED OUTPUT
���ܸ�0123456789���ܸ쥫�����ʤҤ餬��
���ܸ�0123456789���ܸ쥫�����ʤҤ餬��
string(4) "pass"
string(4) "pass"
bool(false)
bool(false)
array(1) {
  [0]=>
  string(4) "pass"
}
string(4) "pass"
---- ACTUAL OUTPUT
���ܸ�0123456789���ܸ쥫�����ʤҤ餬��
ƁEܸ�E123456789ƁEܸ�E������ʤҤ餬��
string(4) "pass"
string(4) "pass"
bool(false)
bool(false)
array(1) {
  [0]=>
  string(4) "pass"
}
string(4) "pass"
---- FAILED

mb_http_input_pass.diff

     ���ܸ�0123456789���ܸ쥫�����ʤҤ餬��
002+ ƁEܸ�E123456789ƁEܸ�E������ʤҤ餬��
002- ���ܸ�0123456789���ܸ쥫�����ʤҤ餬��
     string(4) "pass"
     string(4) "pass"
     bool(false)
--

My environment is:

  • Windows 11
  • Probably character code is cp932

Please see below .log file and .diff files.
mb_http_input_test_failes.zip

PHP Version

PHP 8.0 - master

Operating System

Windows

youkidearitai added a commit to youkidearitai/php-src that referenced this issue Jun 3, 2024
Originally, the GET method had to be percent encoded.
This test did not pass on Windows, so I changed it to a percent-encoded parameter.
@alexdowad
Copy link
Contributor

@youkidearitai I really appreciate your reporting and helping to fix this problem.

It would be really good to figure out why we have a behavior difference between Windows and Linux. On my Linux machine, the tests are passing as is.

Is it possible to get more information about on which commits the tests are failing, and on which they are succeeding? You mentioned "PHP 8.0" and "master". I guess it means you tested those 2 revisions? Is it possible to find the latest revision on which the tests succeed?

@youkidearitai
Copy link
Contributor Author

@alexdowad I investigated this problem. It may not have been successful from the beginning.
This test file was SKIP until PHP 7.4.
bce3d0c#diff-9cbcc3138b63a3155a02106da638c05f8c2c9d0a8b0002a626ad29d0c0e4732b

This test has been re-enabled in PHP 8.0 from 226d9dd .

@youkidearitai
Copy link
Contributor Author

This mojibake, I think "Best fit" feature of encoding conversion on Windows.

@alexdowad
Copy link
Contributor

Great investigation!

On 226d9dd, did the test pass on Windows?

@youkidearitai
Copy link
Contributor Author

On 226d9dd, did the test pass on Windows?

Didn't, On 226d9dd test is skipped. The test is not pass any (old) version.

@cmb69
Copy link
Member

cmb69 commented Jul 9, 2024

FWIW, for me, that test passes locally on Windows (cp850 and cp932), and apparently it passes on CI as well.

@youkidearitai
Copy link
Contributor Author

@cmb69 Thank you for confirm. I restarted make test in vs16 and vs17. It passed only vs17 (vs16 is not passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants