Skip to content

Undefined variable name is shortened when contains \0 #13142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorgsowa opened this issue Jan 13, 2024 · 1 comment
Closed

Undefined variable name is shortened when contains \0 #13142

jorgsowa opened this issue Jan 13, 2024 · 1 comment

Comments

@jorgsowa
Copy link
Contributor

Description

The following code:

<?php

$a = "test\0test";

$$a;

https://3v4l.org/vSKAO#v8.3.1

Resulted in this output:

Warning: Undefined variable $test in /in/vSKAO on line 5

But I expected this output instead:

Warning: Undefined variable $test\0test in /in/vSKAO on line 5

Or even:

Warning: Undefined variable $testtest in /in/vSKAO on line 5

PHP Version

PHP 8.3.1

Operating System

No response

@nielsdos
Copy link
Member

nielsdos commented Jan 13, 2024

Essentially the same core issue as #13097
Might or might not be fixed with my PoC fix (#13097 (comment)) but haven't tested this yet.
EDIT: nope it doesn't because it uses zend_error with %s under the hood.

nielsdos added a commit to nielsdos/php-src that referenced this issue Jan 19, 2024
nielsdos added a commit to nielsdos/php-src that referenced this issue Jan 19, 2024
iluuu1994 pushed a commit that referenced this issue Jan 24, 2024
* Added missing global cases to test

* Update gh13142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants