Syntax errors in opensearch.blade.php #5330

Closed
opened 2026-02-05 09:58:07 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @Yangsh888 on GitHub (Jun 24, 2025).

Describe the Bug

There is an error in /resources/views/misc/opensearch.blade.php caused by directly using XML declaration. The first line of the code file:

<?xml version="1.0" encoding="UTF-8"? >

The reason for the error is a syntax error caused by directly using the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the Blade template. In Laravel's Blade templates, the <? The opening tag is mistaken for the start tag of PHP code, but since it is followed by an XML version tag instead of valid PHP code, an error of "unexpected identifier 'version'" is generated.
The solution is to change the XML declaration to output through PHP code, using @php echo '<? xml version="1.0" encoding="UTF-8"? @endphp. This will correctly include the XML declaration in the output without causing a Blade template parsing error.

This is a common problem when dealing with Blade templates that require special XML declarations for XML, RSS, and other similar content. Laravel's Blade engine tries to parse the <? The beginning content is PHP code, so you need to output these special XML tags using the @php echo method.

(From AI)

Steps to Reproduce

Using the latest Release version v25.05.1 can reproduce the issue. There will be a large number of errors in laravel.log

Expected Behaviour

According to the specifications, this line should be repaired as follows:
@php echo '<? xml version="1.0" encoding="UTF-8"? >'; @endphp

Exact BookStack Version

v25.05.1

Originally created by @Yangsh888 on GitHub (Jun 24, 2025). ### Describe the Bug There is an error in /resources/views/misc/opensearch.blade.php caused by directly using XML declaration. The first line of the code file: `<?xml version="1.0" encoding="UTF-8"? >` The reason for the error is a syntax error caused by directly using the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the Blade template. In Laravel's Blade templates, the <? The opening tag is mistaken for the start tag of PHP code, but since it is followed by an XML version tag instead of valid PHP code, an error of "unexpected identifier 'version'" is generated. The solution is to change the XML declaration to output through PHP code, using @php echo '<? xml version="1.0" encoding="UTF-8"? @endphp. This will correctly include the XML declaration in the output without causing a Blade template parsing error. This is a common problem when dealing with Blade templates that require special XML declarations for XML, RSS, and other similar content. Laravel's Blade engine tries to parse the <? The beginning content is PHP code, so you need to output these special XML tags using the @php echo method. (From AI) ### Steps to Reproduce Using the latest Release version v25.05.1 can reproduce the issue. There will be a large number of errors in laravel.log ### Expected Behaviour According to the specifications, this line should be repaired as follows: `@php echo '<? xml version="1.0" encoding="UTF-8"? >'; @endphp` ### Exact BookStack Version v25.05.1
OVERLORD added the 🐛 Bug label 2026-02-05 09:58:07 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 24, 2025):

Hi @Yangsh888,
I'm not seeing any error when checking on this.

There will be a large number of errors in laravel.log

What specific errors are you seeing?

@ssddanbrown commented on GitHub (Jun 24, 2025): Hi @Yangsh888, I'm not seeing any error when checking on this. > There will be a large number of errors in laravel.log What specific errors are you seeing?
Author
Owner

@tobiasge commented on GitHub (Jul 1, 2025):

I'm seeing the same error, but only when I enable OIDC authentication. When I patch the file with line from "Expected Behaviour" above, the error is gone.

@tobiasge commented on GitHub (Jul 1, 2025): I'm seeing the same error, but only when I enable OIDC authentication. When I patch the file with line from "Expected Behaviour" above, the error is gone.
Author
Owner

@ssddanbrown commented on GitHub (Jul 1, 2025):

@tobiasge Really? This should not be related to OIDC authentication at all.
What specific errors are you seeing without changes/patches made?

@ssddanbrown commented on GitHub (Jul 1, 2025): @tobiasge Really? This should not be related to OIDC authentication at all. What specific errors are you seeing without changes/patches made?
Author
Owner

@tobiasge commented on GitHub (Jul 1, 2025):

Here are the log entries I get: https://gist.github.com/tobiasge/4e97a4584d9b5de30a9c0411a0e0b389

@tobiasge commented on GitHub (Jul 1, 2025): Here are the log entries I get: https://gist.github.com/tobiasge/4e97a4584d9b5de30a9c0411a0e0b389
Author
Owner

@ssddanbrown commented on GitHub (Jul 1, 2025):

Thanks @tobiasge,
Can you confirm environment details (Install method, Operating System, web-server etc...).

@ssddanbrown commented on GitHub (Jul 1, 2025): Thanks @tobiasge, Can you confirm environment details (Install method, Operating System, web-server etc...).
Author
Owner

@tobiasge commented on GitHub (Jul 1, 2025):

I'm using the Docker image from https://github.com/solidnerd/docker-bookstack in Openshift.
Remembering from my old PHP days, I think this might be a problem with the short open tags setting in PHP.

@tobiasge commented on GitHub (Jul 1, 2025): I'm using the Docker image from https://github.com/solidnerd/docker-bookstack in Openshift. Remembering from my old PHP days, I think this might be a problem with the short open tags setting in PHP.
Author
Owner

@ssddanbrown commented on GitHub (Jul 1, 2025):

Thanks @tobiasge, Your guess was spot-on!
Didn't realise that was enabled by default in PHP (yet disabled by default in many common environments & distributions).

This is now patched via 3d017594a8, to be part of the next patch release.
Thanks @tobiasge and @Yangsh888!

@ssddanbrown commented on GitHub (Jul 1, 2025): Thanks @tobiasge, Your guess was spot-on! Didn't realise that was enabled by default in PHP (yet disabled by default in many common environments & distributions). This is now patched via 3d017594a8d4a9f52d4f1f3651995531c2e7eeb0, to be part of the next patch release. Thanks @tobiasge and @Yangsh888!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5330