Repository navigation
[5.8] Fix appending path to inline Blade views - #28141
Conversation
|
Short tags ( |
|
This would be valid PHP code to have in a Blade view too, but would also cause a syntax error with the proposed change: Hello world
<?php echo 'foo';
/* <?php echo 'bar'; ?> */ |
@fitztrev good call. Added this.
@fitztrev I get an error when I try to render this in a blade view. I believe closing tags are always needed which makes some of my tests unnecessary actually. |
|
Here's valid code that does not work under the latest change. <?php echo '<?xml version="1.0" encoding="UTF-8"?>';Here's a failing test for it: 'Echo XML declaration' => [
'<?php echo \'<?xml version="1.0" encoding="UTF-8"?>\';',
'<?php echo \'<?xml version="1.0" encoding="UTF-8"?>\'; ?><?php /**PATH foo ENDPATH**/ ?>',
], |
|
@fitztrev Pushed a commit which should take into account all scenarios now. Made use of the tokenizer extension to check for the opening and closing tags. I didn't add a test for the short tags because it will fail if they're not enabled but they should be covered as well now. |
When appending the view path to Blade views with only one line and opening tags we should take into consideration for closing the PHP tag first before appending the path. I've addeded tests which should cover quite a few situations. Thanks to Sisve for making me aware of this: #28117 (comment)
|
@fitztrev thanks for your help with this! |
[5.8] Fix appending path to inline Blade views
When appending the view path to Blade views with only one line and opening tags we should take into consideration for closing the PHP tag first before appending the path. I've added tests which should cover quite a few situations.
Thanks to Sisve for making me aware of this: #28117 (comment)