Portal Home > Knowledgebase > Articles Database > Function split() deprecated problems..


Function split() deprecated problems..




Posted by 2399Skillz, 11-13-2012, 11:41 AM
So I am getting an error: Line 118 is this So I replaced the split() function with the explode() function like this: However I am now getting a new error: So line 127, 128 and 129 are as follows: 127 = blank line 128 = the commented line 129 = If ($showscreenshot == true)

Posted by zoid, 11-13-2012, 11:49 AM
I guess you forgot somewhere a semicolon. Are these the lines of index.php?

Posted by 2399Skillz, 11-13-2012, 11:52 AM
Yes they are. Gonna look around for a missing semicolon now. Would I get this error, even if the only thing I changed was the split line? The script works fine even with split, but I get an ugly error code on the page when I use it.

Posted by zoid, 11-13-2012, 11:55 AM
No, changing split() should not (and almost definitely will not) raise this error. Maybe revert to the previous version and carefully make the change. Something a semicolon is missing or too much or something which makes the parser trip.

Posted by 2399Skillz, 11-13-2012, 12:04 PM
Well that's weird, what was causing the problem was in the commented line. Apparently the apostrophe was causing issues. I removed it out of line 128 (and five other comments) and the error went away. Now I am getting this error: Line 118 is as follows:

Posted by zoid, 11-13-2012, 12:06 PM
I dont think it was the comment. There must be an error somewhere before that.

Posted by 2399Skillz, 11-13-2012, 12:19 PM
I sold the issue, the line should have been: All works well now.

Posted by 2399Skillz, 11-13-2012, 01:08 PM
Apparently I was wrong, that doesn't solve the issue. What is does is stop the error but it also no longer parses any information. Everything is blank when I load the script. (No values) I'm thinking now it's because of the \' in the code. For some reason I think it has to do with the first error in the script, thinking that the \ is replacing a ' or cancelling out the ' or something along those lines.

Posted by zoid, 11-13-2012, 01:11 PM
Try \\ .

Posted by 2399Skillz, 11-13-2012, 01:26 PM
Okay, I think I finally figured it out. Seems to work now.

Posted by 2399Skillz, 11-13-2012, 01:50 PM
Just noticed your reply. Thanks.

Posted by cheesedude, 11-13-2012, 02:33 PM
The backslash is an escape character. So if you want to explode on (or search for) a literal backslash, you have to escape the backslash with another escape character backslash as you have discovered. '\\'

Posted by syleishere, 11-17-2012, 12:59 PM
Yeah its pretty dumb, if quoting with single quotes should be taken literally like perl, '\' should = \ ,but "\" should be written as "\\", just a flaw in php, in general when unsure escape any special characters.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read