[php-src] PR #19670: Improve accuracy of ext_stmt emits during pipe operations
| From: | derickr | Date: | Tue, 02 Sep 2025 14:16:19 +0000 |
| Subject: | [php-src] PR #19670: Improve accuracy of ext_stmt emits during pipe operations | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33037@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19670
Author: derickr
We need to emit the EXT_STMT opcode before we compile the call, so that we attach the line number of
where the right-hand pipe operator starts.
We also do not need to reset the line number any more.
The following code shows where the EXT_STMTs are now introduced.
```
<?php
/* EXT_STMT */ $myString = "<Hello World>";
$result = /* EXT_STMT */ $myString
|> /* EXT_STMT(!0:$myString) */ \htmlentities(...)
|>
/* EXT_STMT($4) */ \str_split(...)
|> /* EXT_STMT($6) */ (fn($x) => array_map(strtoupper(...), $x))
|> /* EXT_STMT($9) */ (fn($x) => join( ', ', $x));
/* EXT_STMT */ echo $result, /* EXT_STMT */ "\n";
```