Posted by davie on 08/27/06 07:09
adnanalam@gmail.com wrote:
> Hi,
>
> I keep getting these errors for at least 500 lines. Not sure what
> exactly is wrong? The same exact script works just fine on my other
> server.
>
> Anyone else having the same problem? Any help would be appreciated.
>
>
> "Notice: Uninitialized string offset: -512 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27
>
> Notice: Uninitialized string offset: -511 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27
>
> Notice: Uninitialized string offset: -510 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27
>
> Notice: Uninitialized string offset: -509 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27
>
> Notice: Uninitialized string offset: -508 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27
>
> Notice: Uninitialized string offset: -507 in
> /home/christo8/public_html/admin/excelReader/oleread.inc on line 27"
Here is a possible gotcha related to oddness involved with accessing
strings by character past the end of the string:
$string = 'a';
var_dump($string{2}); // string(0) ""
var_dump($string{7}); // string(0) ""
$string{7} === ''; // TRUE
It appears that anything past the end of the string gives an empty
string.. However, when E_NOTICE is on, the above examples will throw
the message:
Notice: Uninitialized string offset: N in FILE on line LINE
This message cannot be specifically masked with @$string{7}, as is
possible when $string itself is unset.
isset($string{7}); // FALSE
$string{7} === NULL; // FALSE
Even though it seems like a not-NULL value of type string, it is still
considered unset.
[Back to original message]
|