php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78115 Output mismatch
Submitted: 2019-06-05 18:43 UTC Modified: 2019-11-11 22:20 UTC
From: v-altruo at microsoft dot com Assigned: cmb (profile)
Status: Closed Package: Testing related
PHP Version: 7.3.6 OS: Windows
Private report: No CVE-ID: None
 [2019-06-05 18:43 UTC] v-altruo at microsoft dot com
Description:
------------
The test fails across all builds. It also fails for php-7.1.30 and php-7.2.19. 

Test file location: Sapi\cli\tests\bug44564.phpt

Test script:
---------------
<?php
setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8");
var_dump(escapeshellcmd('f{o}<€>'));
var_dump(escapeshellarg('f~|;*Þ?'));
var_dump(escapeshellcmd('?€®đæ?'));
var_dump(escapeshellarg('aŊł€'));

?>

Expected result:
----------------
string(13) "f\{o\}\<€\>"
string(10) "'f~|;*Þ?'"
string(13) "\?€®đæ\?"
string(10) "'aŊł€'"

Actual result:
--------------
string(13) "f^{o^}^<€^>"
string(10) ""f~|;*Þ?""
string(13) "^?€®đæ^?"
string(10) ""aŊł€""

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-06 08:28 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-06-06 08:28 UTC] cmb@php.net
Thanks for reporting!

Actually, this test is supposed to be skipped on Windows[1], since
neither of the given locales is supposed to be accepted there.  It
is indeed skipped when I run locally, and on AppVeyor[2] as well.
On my machine, it would not be skipped, however, if I changed the
LC_CTYPE to LC_ALL.

Anyhow, this issue should be fixed with the suggested fix for bug
#77937[3].  Please check whether this is indeed the case.

[1] <https://github.com/php/php-src/blob/php-7.3.6/sapi/cli/tests/bug44564.phpt#L5>
[2] <https://ci.appveyor.com/project/php/php-src/builds/25063179/job/hnobwca23aq8fnle#L5677>
[3] <https://github.com/php/php-src/pull/4169>
 [2019-06-06 18:54 UTC] v-altruo at microsoft dot com
-Status: Feedback +Status: Assigned
 [2019-06-06 18:54 UTC] v-altruo at microsoft dot com
Previously, on 7.2.19RC1 and 7.3.6RC1 builds, it failed for me as well. However, when I had someone else check it, it skipped for them. This time around it seems to have not skipped for either of us. 

Using the snap for the fix related to locales.phpt, it still didn't pass/skip this particular test when I tried it.
 [2019-06-11 10:33 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2019-06-11 10:33 UTC] cmb@php.net
Thanks for the feedback!

If you used PFFT2, please double-check with run-tests.php, or try
<https://github.com/php/pftt2/pull/41>.
 [2019-06-11 17:44 UTC] v-altruo at microsoft dot com
-Status: Feedback +Status: Assigned
 [2019-06-11 17:44 UTC] v-altruo at microsoft dot com
Prior to this I did not run this test with pftt. I only ran it with run-test.php and it failed.

However, now I tried to run it with pftt (with the suggested fix) and run-tests.php and it still fails instead of skipping.
 [2019-06-24 15:19 UTC] cmb@php.net
Please change the skip-if clause[1] to

  if (false == setlocale(LC_CTYPE, "UTF8")) {

and

  if (false == setlocale(LC_CTYPE, "en_US.UTF-8")) {

and run the test again (i.e. two runs). Is the test skipped for either variant?


[1] <https://github.com/php/php-src/blob/php-7.3.6/sapi/cli/tests/bug44564.phpt#L5>
 [2019-06-24 15:29 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2019-06-24 17:31 UTC] v-altruo at microsoft dot com
-Status: Feedback +Status: Assigned
 [2019-06-24 17:31 UTC] v-altruo at microsoft dot com
The test is skipped for: 

  if (false == setlocale(LC_CTYPE, "UTF8")) {

Test fails for: 

  if (false == setlocale(LC_CTYPE, "en_US.UTF8")) {
 [2019-06-24 18:35 UTC] requinix@php.net
"en_US.UTF8" shouldn't be working on Windows...

What does
  var_dump(setlocale(LC_CTYPE, "en_US.UTF8"));
show for you?
 [2019-06-24 18:55 UTC] v-altruo at microsoft dot com
Output for "var_dump(setlocale(LC_CTYPE, "en_US.UTF8"));":

  string(10) "en_US.UTF8"
 [2019-06-24 20:59 UTC] cmb@php.net
> "en_US.UTF8" shouldn't be working on Windows...

Indeed.  However, on some systems it suddenly worked, but commit f3ff72e[1] should have fixed that, i.e. on PHP 7.2.20, 7.3.7, 7.4.0alpha1 and later this test is supposed to be skipped.

[1] <https://github.com/php/php-src/commit/f3ff72e54b2f6c2fa1ac924ad95455a5309099d5>
 [2019-11-11 22:20 UTC] v-altruo at microsoft dot com
-Status: Assigned +Status: Closed
 [2019-11-11 22:20 UTC] v-altruo at microsoft dot com
I apologize for the delay in feedback. Checking the most recent builds (7.1.33, 7.2.24, 7.3.11), this test is skipped now.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Nov 15 18:01:42 2019 UTC