Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 13-04-2009
Member
 
Join Date: Apr 2009
Posts: 87
"Fatal error: Cannot use string offset as an array"

hi,
I get the error message "Fatal error: Cannot use string offset as an array".for my script, I tried to export an t3d file. I tried it using the TV Page module AND the normal page module.but only in PHP5:
Code:
[21] => Array
(
[tag] => UML:CLASS
[type] => open
[level] => 7
[attributes] => Array
(
[XMI.ID] => .:00000000000008EC
[NAME] => quiz_batteries
[VISIBILITY] => public
[ISSPECIFICATION] => true
[ISROOT] => false
[ISLEAF] => false
[ISABSTRACT] => true
[ISACTIVE] => false
)

[value] =>

)

$xmlarray[$x]['tag']['attributes']['NAME']

and I also get the same error on $id=$xmlarray[$x]['tag']['attributes']['XMI.ID'].
Reply With Quote
  #2  
Old 13-04-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: "Fatal error: Cannot use string offset as an array"

I guess the suggested patches will not fix the problem:

You would have to test if $editData is an array, $editData[$key] is an array and $value is an array for both calls - the recursion and the call to $this->callBackObj->$PA['callBackMethod_value'] since all of this three may become strings in somehow broken content .

If you do so, the fatal error is no longer spit in flexformtools, but may occur in class.tx_templavoila_htmlmarkup.php line 540 (FE) and class.t3lib_tceforms.php on line 2595 (BE, editing of the record).

I found german umlauts in my content as well, but there are tons of working flexdata with umlauts while others break.
Reply With Quote
  #3  
Old 13-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: "Fatal error: Cannot use string offset as an array"

The reason you're saw those results is that PHP allows you to manipulate a string as if it were an array. BUT, despite the fact that the array elements exist, it really isn't an array, so you can't treat the elements as if they are true array elements.

Code:
$arr['a'] = "foo";
The above statement assigns a string (aka, an array of characters) to an element of $arr. The array (ahem, "string") has three elements ("f", "o", "o"). You can treat $arr['a'] as an array, but you aren't allowed to change the fact that the content of $arr['a'] is a string. Thus,

Code:
echo $arr['a'][1]; // prints "o"
When you tried to assign a new string to the second element you tried to treat $arr['a'] as a normal array, but it isn't. It's a string that you can manipulate as an array-like way. PHP did the best it could with what you asked, which was to take the first element of the "array" you were trying to assign and assign it to the one element you had referenced.
Reply With Quote
  #4  
Old 13-04-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: "Fatal error: Cannot use string offset as an array"

The first thing that I see a problem with is your for loop statement.

for ($i=0; $i servicesTimeintransit[$type])) {

It should be in the form of

for ($i=0; $i<$var; $i++) {

I think you are getting “Fatal error: Cannot use string offset as an array” because servicesTimeintransit[$type] is an array and not an int or string. I gathered that servicesTimeintransit[$type] is an array as you are calling servicesTimeintransit[$type]["date"] two lines down.

I hope that helps.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: ""Fatal error: Cannot use string offset as an array""
Thread Thread Starter Forum Replies Last Post
Officejet 6500 E709n "fatal error during installation" error on windows 7 BobTurner Hardware Peripherals 5 07-05-2012 06:02 PM
Getting error "ERROR #1 (0x13370001) Fatal ExceptionERROR #1 (0x13370001) Fatal Exception" while installing Diablo III eDDy.Gueraro Video Games 5 19-03-2012 09:48 AM
How to Fix "Fatal error during gameserver connection" error in Worms World Party Raju S Video Games 4 27-03-2011 04:01 AM
Windows Vista error message "scanpst.exe fails with Fatal Error: 80040818 " B_Hodge Windows Software 5 25-02-2011 04:47 PM
"FATAL: Module not found error" using modprobe Alysa Operating Systems 5 24-04-2010 12:49 PM


All times are GMT +5.5. The time now is 03:12 AM.