Skip to content

Commit fa3c1c8

Browse files
DanielEScherzernielsdos
authored andcommitted
Fix GH-17836: zend_vm_gen.php shouldn't break on Windows line endings
Closes GH-18121.
1 parent 447d143 commit fa3c1c8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ PHP NEWS
5353
- Treewide:
5454
. Fixed bug GH-17736 (Assertion failure zend_reference_destroy()). (nielsdos)
5555

56+
- Windows:
57+
. Fixed bug GH-17836 (zend_vm_gen.php shouldn't break on Windows line
58+
endings). (DanielEScherzer)
59+
5660
13 Mar 2025, PHP 8.3.19
5761

5862
- BCMath:

Zend/zend_vm_gen.php

+6
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,12 @@ function gen_vm($def, $skel) {
24012401
$max_opcode = 0;
24022402
$extra_num = 256;
24032403
foreach ($in as $line) {
2404+
// Handle Windows line endings, GH-17836; since a bunch of regular
2405+
// expressions below test for a newline at the end, just update the
2406+
// ending
2407+
if (substr($line, -2) === "\r\n") {
2408+
$line = substr_replace($line, "\n", -2);
2409+
}
24042410
++$lineno;
24052411
if (strpos($line,"ZEND_VM_HANDLER(") === 0 ||
24062412
strpos($line,"ZEND_VM_INLINE_HANDLER(") === 0 ||

0 commit comments

Comments
 (0)