Skip to content
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

T_INLINE_HTML changes between minor versions from 267 to 318 and back causing laravel blades to fail #18067

Closed
macropay-solutions opened this issue Mar 14, 2025 · 5 comments

Comments

@macropay-solutions
Copy link

macropay-solutions commented Mar 14, 2025

Description

The following code:

<?php

echo T_INLINE_HTML;

Resulted in this output:

Image

This was discovered while debugging this blade rendering issue laravel/framework#52382 (reply in thread)

that is affecting laravel blade templating.

First step that lead to this laravel/framework#52382 (comment) was discovered by @JFBauer-ZeroPlex.

Tested on https://onlinephp.io/ and also on local and shared. More details in the thread.

PHP Version

8.0->8.4

Operating System

No response

Is this normal? Why change the constant value from minor version to minor version?

@bwoebi
Copy link
Member

bwoebi commented Mar 14, 2025

We do not do any guarantees on the values of the constants. The values don't change intentionally either, but are a side-effect of the parser generation.

This is not a bug, but something which must not be relied upon. For purposes of storing tokens, we recommend the string representation as token names are unlikely to change - at least not without note in UPGRADING.

@bwoebi bwoebi closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2025
@macropay-solutions
Copy link
Author

@bwoebi thank you for explaining.

@macropay-solutions
Copy link
Author

macropay-solutions commented Mar 14, 2025

@bwoebi

NOTE. Laravel uses string representations like T_INLINE_HTML but these get changed during the php lifecycle as explained in that comment .

@JFBauer-ZeroPlex
Copy link

JFBauer-ZeroPlex commented Mar 14, 2025

@bwoebi I do have one follow-up question which i can't wrap my finger around. Possibly you or someone else from the PHP team can speed things up there. We encountered an issue as @macropay-solutions, described and linked to the original issue.

  1. Laravel correctly refers to the constant using T_INLINE_HTML.
  2. My managed hosting party did an update from PHP 8.3.16 to 8.3.17 which seems to change T_INLINE_HTML and likely the values of other tokens as well. But to keep it specific, it changes T_INLINE_HTML from 276 to 318
  3. During a single request i checked both the PHP version and T_INLINE_HTML and i get back 8.3.17 and 276, which doesn't match what I would've expected.
  4. Now if i do systemctl reload php83-fpm or systemctl restart for that matter, the issue is resolved.

I already have a question open with the 3rd party that manages the server and performs those updates, to ask what exactly their update procedure looks like. But I still see to fail how it can have things mixed up between versions somehow. Assuming you have more experience with PHP itself, maybe you can explain why and how these situations can occur where the version is updated but not the constants or similar situations. As far as i can see/understand Laravel's code works perfectly fine on 8.3.16 and also on 8.3.17, it's just that it apparently is possible to somehow get a mixture of the two

@bwoebi
Copy link
Member

bwoebi commented Mar 14, 2025

I don't know how that would happen. that being getting back the old value for T_INLINE_HTML and the new value for the php version in the same request.
I'd expect updates to require a proper reload of fpm anyway?

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

No branches or pull requests

3 participants