[php-src] Issue #15720: Escaped \${var} in Heredoc produces warning
| From: | mediaformat | Date: | Tue, 03 Sep 2024 04:47:16 +0000 |
| Subject: | [php-src] Issue #15720: Escaped \${var} in Heredoc produces warning | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247685@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15720
Author: mediaformat
### Description
Within a Heredoc statement, the parser correctly escapes the
\${url} used in the
Template literal, treating it a string, but incorrectly, IMHO, emits a Warning:
> Deprecated: Using ${var} in strings is deprecated, use {$var} instead.
The following code:
```php
<?php
$script = <<<HTML
<script>
window.addEventListener("message", getFrames, false);
function getFrames (e) {
if (e.data.hasOwnProperty("height") && e.data.hasOwnProperty("url"))
{
let url = e.data.url.toString();
let myFrame = document.querySelector(iframe[src^='\${url}']);
...
```
**The actual output is correct**
But I expected no Warning since I'm not using ${url} but \${url}
### PHP Version
PHP 8.2.20
### Operating System
_No response_