Visual Theme Error #2847

Closed
opened 2026-02-05 05:26:41 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @Arkantium on GitHub (Jun 11, 2022).

Describe the Bug

I try to create a custom code in Visual Theme but i have always an error:
image

i have try rename the classe: ThisClassNotExistInPHPOrInBookstack
i have the same error. Bug in the Visual Theme ?

Steps to Reproduce

Read the screen :)

Expected Behaviour

Functionnal :)

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

22.04.2

PHP Version

No response

Hosting Environment

PHP 8.0.19

Originally created by @Arkantium on GitHub (Jun 11, 2022). ### Describe the Bug I try to create a custom code in Visual Theme but i have always an error: ![image](https://user-images.githubusercontent.com/7194804/173190237-89cbac90-a2b4-4519-b481-820ce55b1e0d.png) i have try rename the classe: ThisClassNotExistInPHPOrInBookstack i have the same error. Bug in the Visual Theme ? ### Steps to Reproduce Read the screen :) ### Expected Behaviour Functionnal :) ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version 22.04.2 ### PHP Version _No response_ ### Hosting Environment PHP 8.0.19
OVERLORD added the 🐛 Bug label 2026-02-05 05:26:41 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 12, 2022):

Hi @Arkantium,

I am not able to reproduce this error in my environment.
This kind of thing could occur if the theme functions file was loaded in multiple times instead of just once.

Have you potentially altered the theme system core code or changed composer-based loading at all?

@ssddanbrown commented on GitHub (Jun 12, 2022): Hi @Arkantium, I am not able to reproduce this error in my environment. This kind of thing could occur if the theme functions file was loaded in multiple times instead of just once. Have you potentially altered the theme system core code or changed composer-based loading at all?
Author
Owner

@Arkantium commented on GitHub (Jun 12, 2022):

Hi,

No modification for now :) just added the name in the .env
I have try delete cache, optimize clear and reload composer but same...

@Arkantium commented on GitHub (Jun 12, 2022): Hi, No modification for now :) just added the name in the .env I have try delete cache, optimize clear and reload composer but same...
Author
Owner

@ssddanbrown commented on GitHub (Jun 12, 2022):

@Arkantium Okay, I just noticed the error shown in the screenshot appears to be on the command line.
What exactly are you doing when this error shows?

@ssddanbrown commented on GitHub (Jun 12, 2022): @Arkantium Okay, I just noticed the error shown in the screenshot appears to be on the command line. What exactly are you doing when this error shows?
Author
Owner

@Arkantium commented on GitHub (Jun 12, 2022):

php artisan optimize

@Arkantium commented on GitHub (Jun 12, 2022): php artisan optimize
Author
Owner

@ssddanbrown commented on GitHub (Jun 12, 2022):

Ah, Okay. The optimize and cache commands are not something we specifically document or support.

This occurs because the cache commands start a secondary app instance which re-includes the theme functions file, which would then attempt to re-create any classes.

To work around this you can put you classes into separate files then require_once them into your functions.php.

@ssddanbrown commented on GitHub (Jun 12, 2022): Ah, Okay. The optimize and cache commands are not something we specifically document or support. This occurs because the cache commands start a secondary app instance which re-includes the theme functions file, which would then attempt to re-create any classes. To work around this you can put you classes into separate files then `require_once` them into your `functions.php`.
Author
Owner

@ssddanbrown commented on GitHub (Jun 16, 2022):

I'll therefore go ahead and close this off.

@ssddanbrown commented on GitHub (Jun 16, 2022): I'll therefore go ahead and close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2847