Uninitialized string offset


#1

I’m new to this group so I’m not sure if I’m posting this in the right category but I’m having a problem with some error messages that appear in Chrome’s View Page Source. They are generated after running a script that displays correctly on a web page but not in View Page Source. They seem to be connected to an array that I’m using in one of the classes. Without getting into too much detail, gettype() calls the array ‘array’ on the page but in View Page Source it calls it ‘string’. Because of this it generates a number of ‘Notice: Uninitialized string offset’ messages in code that follows that statement. This occurs when xdebug is enabled or disabled. If I hard-code this array in a separate script, independent of the program I’ve written, and run a loop to display data I get no errors in View Page Source as it only occurs within the program.

If anyone has some good advice as to why this is happening I’d appreciate it. Thanks.


#2

We cant see your screen. Post the URL.


#3

Kevin, my application is being run locally on WampServer so I can’t give you a live URL. In any case I don’t think the screen output will tell you much as the error only occurs in View Page Source but so you know, the output line on the screen reads:
type: array

whereas View Page Source reads:
type: string

This results from the statement:
echo 'type: '.gettype($reportArr);

in my code. $reportArr is an array that is displaying a table on my screen.
If you feel you can help me with this I’d be happy to know, Thanks.


#4

Post the script that causes the problem.


#5

Its part of a method within a class that’s over 6000 lines but this is the part that causes the error…

// Retrieve the MySql array
$reportArr = $this->findArrValue(‘logArr’);
echo 'type: '.gettype($reportArr);

Its calling a method that looks up a value in another array. The value is the array I need. It finds it and returns it. Then like I said it displays it and everything’s fine on-screen. It’s just the HTML source code that shows it as a string and not an array.


#6

If you have a class with 6000 + lines you have bigger problems. This is sounding familiar. I am thinking you have posted about this “class” before on some forum.

Bottom line, no one is going to be able to help with the information you have provided. Telling us about methods and arrays and values and tables on YOUR screen and classes we can’t see is just pointless and wasting our time.


#7

That concerns me, and doesn’t sound correct AT ALL. A string sent to a browser does not change based on the browser.