Skip to content

Conversation

hosni
Copy link
Contributor

@hosni hosni commented Oct 4, 2025

This PR fixes an issue where the @pushIf directive incorrectly parsed expressions containing multiple commas within nested function calls or array arguments.
This caused the directive to generate invalid PHP during compilation when the condition itself contained commas.

Before

@pushIf(Str::startsWith('abc', 'a'), 'body-end')
test
@endPushIf

To:

<?php if(Str::startsWith('abc'): $__env->startPush( 'a'), 'body-end'); ?>
test
<?php $__env->stopPush(); endif; ?>

❌ Compiled incorrectly, broken expression.

After

✅ Compiles correctly:

@pushIf(Str::startsWith('abc', 'a'), 'body-end')
test
@endPushIf

To:

<?php if(Str::startsWith('abc', 'a')): $__env->startPush('body-end'); ?>
test
<?php $__env->stopPush(); endif; ?>

This is related to issue: #57264

@taylorotwell taylorotwell merged commit 1f0bcbf into laravel:12.x Oct 4, 2025
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants