Page 1 of 1
PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:35 am
by Disent
Hi, i have a problem while changing PHP 4 code to work on PHP 5.
If anyone is willing to help me out a bit please add me to msn. file[dot]syntax[at]hotmail[dot]com
Thanks.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:37 am
by Chris Corbyn
This is not what our web forum is for. I'm also not convinced you'll get much help by asking people to MSN you in order to help you. Please post your problem here so others can help you and so that (possibly) in future others can be helped by reading your problem with its solution.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:43 am
by Disent
Ok sorry.
in php 5 get_class has to be changed to strtolower(get_class($str))
but after i do the change one of the files gives me an error because of a function. (first line of it)
Code: Select all
function BreakString($strText, $intMaxLength, $strSuffix = "") {
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:48 am
by Chris Corbyn
Disent wrote:Ok sorry.
in php 5 get_class has to be changed to strtolower(get_class($str))
but after i do the change one of the files gives me an error because of a function. (first line of it)
Code: Select all
function BreakString($strText, $intMaxLength, $strSuffix = "") {
What is the error it gives you?
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:50 am
by Disent
It gives me a an error that actually points to a different file but im pretty sure the error is there because i traced.
anyway this is what the error referes to:
foreach ($engSystem->arrStructure[INTERFACE_NAME][$engUser->fnGetParam("level")] AS $tmpKey => $tmpItem) {
"level" seems to be empty...
Warning: Invalid argument supplied for foreach() in index.php on line 30
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:55 am
by Chris Corbyn
I'm really sorry but you're talking in riddles

Could you please elaborate on the exact nature of your problem? Posting these tiny little excerpts of code is telling me nothing at all since I have no idea what that code is supposed to do and/or what's not working. If you're getting an error message please post the exact error message here. if you're not getting an error but something isn't working, please start from the beginning, explaining what *should* be happening, but describing what *is* happening. Also post as much code as you think is relevant... not just these partial lines.
You need to help us understand your problem before we can help you

Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 4:59 am
by Disent
It's a whole costum CMS system.
My assignment today is to change a clients PHP 4 version to PHP 5.
I searched get_class i all the files and replaced them all with strtolower get_class and replaced the old files. Now if i replace general.inc it gives me the error but if i keep the old general.inc it works on php 4 atleast. So thats how i know the error is there. I tested the code on php 5 too but it gives me the same error and even more. For some reason its pointing to index.php but that works fine with the old general.inc.
I used exit; to find the line where it breaks. and that points to the line i gave you(the functions first line).
What that function is supposed to do is to check if the strText is longer than max allowed(for formating reasons).
This function i runned everytime i load the page.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 5:02 am
by Chris Corbyn
What error?
j/k

Seriously though, we need to know the error.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 5:05 am
by Disent
check my posts. I already showed you the error. I edited both my posts i think.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 5:27 am
by JAM
Sorry, but I can't find the error you state you post either, just small lumps of code..
You have a problem with:
Code: Select all
foreach ($engSystem->arrStructure[INTERFACE_NAME][$engUser->fnGetParam("level")] AS $tmpKey => $tmpItem) {
...giving you...
Warning: Invalid argument supplied for foreach() in index.php on line 30
...but you also state that the problem lies within here...
Code: Select all
function BreakString($strText, $intMaxLength, $strSuffix = "") {
It's just not enough to assist with. For me.
Re: PHP 4 -> 5 problem.
Posted: Mon Jan 28, 2008 5:41 am
by Disent
Thats why i wanted to get someone on msn. I don't want to post alot of code on the internet when its not mine.
Re: PHP 4 -> 5 problem.
Posted: Tue Jan 29, 2008 1:38 am
by Disent
After i change the servers settings to run on PHP 5. I get this:
Warning: session_start() [function.session-start]: open(/var/tmp/sess_86c7d68856073d8a17c4ac47219fc5e4, O_RDWR) failed: Permission denied (13) in /htdocs/init/public.inc on line 5
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /htdocs/init/public.inc:5) in htdocs/init/public.inc on line 5
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /htdocs/init/public.inc:5) in /htdocs/init/public.inc on line 5
Warning: Cannot modify header information - headers already sent by (output started at /htdocs/init/public.inc:5) in /htdocs/init/public.inc on line 34
Internal Server Error
.......which says htacces file uses restricted directives and the PHP script takes too much resources... change the memory limit (memory_limit).
Not sure if i got this all right in english.
Re: PHP 4 -> 5 problem.
Posted: Tue Jan 29, 2008 1:57 am
by Christopher
It looks like the webserver does not have permission to write to '/var/tmp/'. It may not exist or have the wrong permissions. Create it, change the permissions, or change it php.ini to '/tmp'.