aleX_hill Posted October 28, 2010 Share Posted October 28, 2010 OK, this is a strange one I am hoping someone can help with. I have a file with a heap of functions which work fine. This file is included in my other files, and the function to display the content is called. For example I include the master file in guestbook.php, which calls showGuestbook(). Same with contact.php, it calles showContact(); etc. The file is outside the web root of the website calling it. So I went to add another function called downloadFile(). When I try to call the function, it gives me the "call to undefined function" error. I have tried renaming it to a few diff things, same error. So I thought there could be a brace error somewehere in the file. This is the strange bit.... When I put that function at the top of the file, the page seems to fail to parse. None of the functions are available... The function so far is simply: function downloadFile() { echo "Download File"; } Can anyone shed some light on this strange behaviour, especially the errors that occur just because I move the code higher up the file. Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/ Share on other sites More sharing options...
trq Posted October 28, 2010 Share Posted October 28, 2010 There is nothing syntactically wrong with the function. Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/#findComment-1127438 Share on other sites More sharing options...
aleX_hill Posted October 28, 2010 Author Share Posted October 28, 2010 Thanks thorpe. I know that, which is why I am so puzzled... Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/#findComment-1127445 Share on other sites More sharing options...
Anti-Moronic Posted October 28, 2010 Share Posted October 28, 2010 True puzzle..especially from here since we can't see any of your code. Sometimes when apparently stupid things like this keep happening, I take drastic measures. Put the code at the top, make sure it works on it's own within this file first. Then, begin to add your previous functions to the file one by one, and maybe just one will trigger the error. Now you have pinpointed the source. I really can't think of *any* reason why this would cause a parse issue unless the function is within another function. Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/#findComment-1127465 Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2010 Share Posted October 28, 2010 Just posting 4 lines of code out of context almost never results in a solution because that is not all of the relevant code that is producing the error. Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/#findComment-1127470 Share on other sites More sharing options...
aleX_hill Posted October 28, 2010 Author Share Posted October 28, 2010 I do realise I am a bit vague on the code. The function file is over 600 lines long, hence me not posting it here. I will try removing all other functions and see how that goes... Quote Link to comment https://forums.phpfreaks.com/topic/217083-strange-function-problem/#findComment-1127480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.