Skip to content

Commit 8d7cb8c

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-17836: zend_vm_gen.php shouldn't break on Windows line endings
2 parents e98e4e3 + fa3c1c8 commit 8d7cb8c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ PHP NEWS
8484
- Treewide:
8585
. Fixed bug GH-17736 (Assertion failure zend_reference_destroy()). (nielsdos)
8686

87+
- Windows:
88+
. Fixed bug GH-17836 (zend_vm_gen.php shouldn't break on Windows line
89+
endings). (DanielEScherzer)
90+
8791
27 Feb 2025, PHP 8.4.5
8892

8993
- BCMath:

Zend/zend_vm_gen.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,6 +2416,12 @@ function gen_vm($def, $skel) {
24162416
$max_opcode = 0;
24172417
$extra_num = 256;
24182418
foreach ($in as $line) {
2419+
// Handle Windows line endings, GH-17836; since a bunch of regular
2420+
// expressions below test for a newline at the end, just update the
2421+
// ending
2422+
if (substr($line, -2) === "\r\n") {
2423+
$line = substr_replace($line, "\n", -2);
2424+
}
24192425
++$lineno;
24202426
if (strpos($line,"ZEND_VM_HANDLER(") === 0 ||
24212427
strpos($line,"ZEND_VM_INLINE_HANDLER(") === 0 ||

0 commit comments

Comments
 (0)