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

Fix PHP Fatal Error #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

MachX428
Copy link

Template does not work and makes Dokuwiki unusable. The following error
can be found in log/nginx/error.log:

"PHP message: PHP Fatal error: Call to undefined function tpl_js() in
/config/dokuwiki/lib/tpl/codowik/main.php:36"

I believe this is due to a bad merge. Fixed the issue and now everything
works. Tested on Release 2020-07-29 "Hogfather".

Template does not work and makes Dokuwiki unusable. The following error
can be found in log/nginx/error.log:

"PHP message: PHP Fatal error: Call to undefined function tpl_js() in
/config/dokuwiki/lib/tpl/codowik/main.php:36"

I believe this is due to a bad merge. Fixed the issue and now everything
works. Tested on Release 2020-07-29 "Hogfather".
@kotadr
Copy link

kotadr commented Feb 14, 2023

To solve the problem, you need to add the definition of the function to the main.php file:

/**
 * Returns HTML string with script tag
 * @param  string $filename
 * @return string
 */
function tpl_js($filename)
{
    $filepath = DOKU_TPL . 'js' . DIRECTORY_SEPARATOR . $filename;
    return "<script type=\"application/javascript\" src=\"{$filepath}\"></script>";
}

@MachX428
Copy link
Author

MachX428 commented Feb 14, 2023

Hello @kotadr . Thank you for the note! Just to clarify, are you saying you are still having the PHP Fatal Error problem AFTER applying my changes? After my changes, I no longer had them. If I remember correctly (it's been about a year and half since I looked at this), the problem here appeared when the last commit (0916d3b) which merged in a PR which pulled some functions back into main.php which on previous commit (93b77a8) had just been moved out of main.php into main.js. With this merge, these functions now existed in both places. Since all of these merges/commits happened the same day, I think it was just a case of each PR working independently, but merging them all together caused a problem because those functions were now duplicated in different places. Anyway, my "fix" (which was just really correcting the merge) caused the problem to go away for me, as the functions now existed only in main.js. I have been running with my mods for the past year and a half without any issues. I even have them deployed on a friend's instance and he is also having no problems. So I just want to double check - are you saying that my changes did not work for you and you are still getting the PHPFatalError? Thanks again for taking the time!

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