Bug #80936 [Com]: php.exe -f test.php doesn't work

From: Date: Mon, 30 Jan 2023 05:26:11 +0000
Subject: Bug #80936 [Com]: php.exe -f test.php doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243591@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80936&edit=1

 ID:                 80936
 Comment by:         focusmoon23 at gmail dot com
 Reported by:        samsanchez at qq dot com
 Summary:            php.exe -f test.php doesn't work
 Status:             Not a bug
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Windows 10
 PHP Version:        *
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Avoid wasting hours manually setting up observability for your PHP applications. Leverage open
source quickstarts with New Relic I/O, your hub for Instant Observability.


Previous Comments:
------------------------------------------------------------------------
[2021-04-07 13:21:38] cmb@php.net

Ah, this is about UTF-16LE, not UTF-8.  I can confirm the reported
behavior, but this is not a bug; at least, you need to enable
zend.multibyte[1] for non ASCII compatible encodings; otherwise
the PHP engine doesn't recognize the <?php.  See also
<https://www.php.net/manual/en/migration71.windows-support.php>.

[1] <https://www.php.net/manual/en/ini.core.php#ini.zend.multibyte>

------------------------------------------------------------------------
[2021-04-06 14:38:50] samsanchez at qq dot com

I attach a file with unicode bom. to reproduce this bug:

1) download the patch file 'rename_this_file_extension.txt'
2) open it by any kindof txt editor. add <?php to the 1st line
3) rename it to test.php
4) command line to exec: php.exe -f tes.php
5) output here it's
<?php

echo 'hello php8';

=====================
what i expect to get are
1) fatal error exception raise
2) or show me 'hello php8'

------------------------------------------------------------------------
[2021-04-06 14:31:12] samsanchez at qq dot com

The following patch has been added/updated:

Patch Name: rename_this_file_extension.txt
Revision:   1617719472
URL:        https://bugs.php.net/patch-display.php?bug=80936&patch=rename_this_file_extension.txt&revision=1617719472

------------------------------------------------------------------------
[2021-04-05 15:29:54] cmb@php.net

I cannot reproduce, neither with JIT enabled nor disabled.

------------------------------------------------------------------------
[2021-04-05 08:51:18] samsanchez at qq dot com

I find the problem is because the encode of test.php is UTF-8 With BOM!
changing the encode to UTF-8 without BOM make it work as expect.

however i think the php cli should raise me an error instead of output the whole source to me.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=80936


--
Edit this bug report at https://bugs.php.net/bug.php?id=80936&edit=1


Thread (16 messages)

« previous php.bugs (#243591) next »