Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Cannot use string offset as an array #121

Closed
GoogleCodeExporter opened this issue Apr 4, 2015 · 26 comments
Closed

Fatal error: Cannot use string offset as an array #121

GoogleCodeExporter opened this issue Apr 4, 2015 · 26 comments

Comments

@GoogleCodeExporter
Copy link

With WordPress 2.6, Geo Mashup 1.1beta3, this error can appear. It may be
related to the version of PHP in use, but is likely a bug.

Original issue reported on code.google.com by dylankk...@gmail.com on 31 Jul 2008 at 11:27

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

The files I posted before had a typo. My attempted fix (sans typos) is now in 
the
trunk version (http://code.google.com/p/wordpress-geo-mashup/source/browse/). 
Since I
don't see the problem in my version of PHP, I can't be sure it works. Please 
let me know.

Original comment by dylankk...@gmail.com on 3 Aug 2008 at 6:18

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Nope, with the trunk version of geo-mashup.php and render-map.php render the 
admin
side completely unusable with a double header send error and the main site 
displays
your notes on the trunk php version.

I dropped the notes out of the bottom of the geo-mashup.php and got the admin 
section
to render, but I still get the same error.

Error when logging into Admin side and clicking on the geo-mashup plugin 
settings:

Fatal error: Cannot use string offset as an array in
/home/findwire/domains/findwirelessinternet.info/public_html/wp-content/plugins/
geo-mashup/geo-mashup.php
on line 615

Error on the mashup page map.

Fatal error: Cannot use string offset as an array in
/home/findwire/domains/findwirelessinternet.info/public_html/wp-content/plugins/
geo-mashup/render-map.php
on line 96

Thanks so much for looking at this !  

I tried the current trunk and the diff trunk from 8/3 without any difference,
currently I have the original beta3 files on the server.

Glenn

Versions from my server:
Apache 2.2.8    Running
DirectAdmin 1.32.2  Running
Exim 4.67   Running
MySQL 5.0.51a   Running
Named 9.3.3rc2  Running
ProFTPd 1.3.1   Running
sshd    Running
dovecot 1.0.10  Running

Original comment by G.E.Sc...@gmail.com on 18 Aug 2008 at 6:05

@GoogleCodeExporter
Copy link
Author

Ok, I think my fix may have worked, but the error popped up in another place. 
The
trunk now contains a second round of fix attempts if you'd like to try it. Same 
two
files.

You supplied versions of everything but PHP - that's the one I'm curious about. 
I'm
on 5.2.6.

Original comment by dylankk...@gmail.com on 18 Aug 2008 at 9:29

@GoogleCodeExporter
Copy link
Author

Got the same error with the version from doanloads. Even with the versions from 
the 
trunk, it is not displaying anymore.

Any hints?

Original comment by mmurc...@gmail.com on 4 Sep 2008 at 4:34

@GoogleCodeExporter
Copy link
Author

Can you give me a URL to look at, or at least a full copy of the error message?

Original comment by dylankk...@gmail.com on 7 Sep 2008 at 2:19

  • Changed state: Investigating

@GoogleCodeExporter
Copy link
Author

Thanks Dylan,

  PHP ver 5 is what my host reports, but they don't report the version in Direct 
Admin nor in the Forums.  

www.findwirelessinternet.info/mashup

Fatal error: Cannot use string offset as an array in 
/home/findwire/domains/findwirelessinternet.info/public_html/wp-content/plugins/
geo-
mashup/render-map.php on line 96

Original comment by G.E.Sc...@gmail.com on 13 Sep 2008 at 2:20

@GoogleCodeExporter
Copy link
Author

I'm not finding any other solutions suggested for this other than upgrading 
PHP. 

You might be able to figure our your PHP version by creating a file on the 
server
with just this in it:

<?php phpinfo(); ?>

and hitting that with a web browser. At this point I'm not sure that will help 
me
much, though.

Original comment by dylankk...@gmail.com on 15 Sep 2008 at 9:54

@GoogleCodeExporter
Copy link
Author

I'm getting a similar error.  Dylan, if it would help, feel free to peek at 
http://www.theglobalguy.com/info.php.

Fatal error: Cannot use string offset as an array in /home/henrym/htdocs/wp-
content/plugins/geo-mashup/geo-mashup.php on line 613

Original comment by henrymal...@gmail.com on 22 Sep 2008 at 7:57

@GoogleCodeExporter
Copy link
Author

Thanks, that does add some information. You and I are running the same version 
of
PHP, 5.2.6, so there must be some difference in the configuration that causes 
the
error. Here is your configuration:

'./configure' '--with-layout=GNU' 
'--with-config-file-path=/usr/local/etc/RCW/php5'
'--with-config-file-scan-dir=/usr/local/etc/RCW/php5/config' '--disable-all'
'--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection'
'--program-prefix=' '--enable-fastcgi' '--with-regex=php' '--with-zend-vm=CALL'
'--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man'
'--infodir=/usr/local/info/' '--build=i386-portbld-freebsd6.3'

and here is mine:

     './configure' '--enable-discard-path' '--with-gettext' '--enable-exif'
'--enable-bcmath' '--enable-calendar' '--enable-magic-quotes' '--with-curl'
'--enable-ftp' '--with-gd' '--with-zlib' '--with-t1lib=/usr/local'
'--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-ttf'
'--with-freetype-dir=/usr' '--with-imap=/usr/local' '--with-imap-ssl'
'--with-mhash=/usr/local' '--with-mcrypt=/usr/local' 
'--with-openssl=/usr/local/ssl'
'--with-mysql=/usr/local/mysql5' '--with-ldap' '--enable-mbstring'
'--enable-inline-optimization' '--with-iconv' '--enable-pcntl' '--with-pspell'
'--with-bz2' '--enable-sockets' '--prefix=/usr/local/php5' '--with-xsl'
'--with-config-file-path=.:/etc' '--enable-soap' '--with-mysqli'
'--with-pdo-mysql=/usr/local/mysql5' 

I'm not sure at this point which option or absence of option to suspect. If 
anyone
else getting the error can post their configuration info, it might help narrow 
it down.

Original comment by dylankk...@gmail.com on 22 Sep 2008 at 9:21

@GoogleCodeExporter
Copy link
Author

Hey Dylan,

I've been doing a bit of research on this, but unfortunately I'm a network guy, 
and 
not a coder.  I've found a few hints on differences between PHP 4 and PHP 5, 
including some stricter coding standards that are now being enforced.  One in 
particular is the third line on this site:

http://www.php.net/manual/en/migration5.incompatible.php

Illegal use of string offsets causes E_ERROR instead of E_WARNING. An example 
illegal use is: $str = 'abc'; unset($str[0]);. 

Does that make any sense? 

Original comment by henrymal...@gmail.com on 2 Oct 2008 at 2:43

@GoogleCodeExporter
Copy link
Author

See if this helps as well:

http://www.zend.com/forums/index.php?
t=msg&goto=6396&S=05a0af54d2545c67e9f72ffc5ae34c74#msg_6396

Original comment by henrymal...@gmail.com on 2 Oct 2008 at 2:47

@GoogleCodeExporter
Copy link
Author

Ok, I've got a fix.  From my limited understanding of the error, it's caused 
when a 
string is treated as an array.  Simply adding the line

$geoMashupOpts=array();

Above line 613 seems to have fixed the problem for me.  I think I'm using a 
sledgehammer to fix the problem, but it's good enough for the moment.

I used the information on this site:

http://informationideas.com/news/2006/06/14/fatal-error-cannot-use-string-offset
-as-
an-array-in/

to hack in my fix.

Thoughts?

Original comment by henrymal...@gmail.com on 2 Oct 2008 at 3:05

@GoogleCodeExporter
Copy link
Author

Well, that fixed the initial problem, but now the plugin doesn't seem to be 
able to 
read options stored in the database.  When I got to the options page, it's 
always 
blank, but if I look in the database itself, the options are updated.  Even 
though 
I've got a valid key stored in the database, I'm getting the google key error.


Original comment by henrymal...@gmail.com on 2 Oct 2008 at 3:58

@GoogleCodeExporter
Copy link
Author

Sorry for the multiple messages...

I fixed the previous error...I just moved the $geoMashupOpts=array(); line to 
the 
top of the file.  It now looks like this:

load_plugin_textdomain('GeoMashup', 'wp-content/plugins/geo-mashup/languages');
$geoMashupOpts=array();
$geoMashupOpts = get_settings('geo_mashup_options');

Original comment by henrymal...@gmail.com on 2 Oct 2008 at 4:03

@GoogleCodeExporter
Copy link
Author

I have this error and I'm running PHP 4.4.8 @ dreamhost. 

The offending code is on line 614, somewhere in here:
$geoMashupOpts['category_line_zoom'][$category->slug]

It's trying to refer to a string position 
($geoMashupOpts['category_line_zoom']) with
 an array reference (apparently). I tried declaring
$geoMashupOpts['category_line_zoom'] as an array, but that didn't help. I also 
tried
declaring the $geoMashupOpts as an array as henrymalmgren suggests, but it also
didn't help.

Any other ideas anyone?

Original comment by mrgreen...@gmail.com on 15 Oct 2008 at 11:19

@GoogleCodeExporter
Copy link
Author

mrgreenfur, can you try this version and let us know if it works? It's 
combination of
henrymalmgren's solution and some array testing in your problem area.

Original comment by dylankk...@gmail.com on 22 Oct 2008 at 3:06

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Dylan, the settings page now loads okay, but the default values for some 
options are
strange and the page doesn't seem to update properly. The value for all of the
options is set to "U" and doesn't update when I drop in my maps api key or 
default
zoom level, etc.

Not sure why...

Original comment by mrgreen...@gmail.com on 25 Oct 2008 at 7:21

@GoogleCodeExporter
Copy link
Author

That's not good - the long unsolved Issue 87:
http://code.google.com/p/wordpress-geo-mashup/issues/detail?id=87. There is a
workaround there, although it's somewhat painful. Sorry, I wish I had a clue 
how that
happens!

Original comment by dylankk...@gmail.com on 25 Oct 2008 at 8:35

@GoogleCodeExporter
Copy link
Author

At least issue 87 is easily resolved. I erased a few rows in the DB and it 
seems to
work. For some reason under 'overall settings' I can't change the 'map control' 
to
anything other than 'small zoom', it always reverts back. 

Anyhow, your fix fixed it! Thanks for the help!

Original comment by mrgreen...@gmail.com on 28 Oct 2008 at 12:30

@GoogleCodeExporter
Copy link
Author

mrgreenfur, would you be willing to try this file? I had some ideas for 
preventing
the Issue 87 problem. Thanks!

Original comment by dylankk...@gmail.com on 29 Oct 2008 at 2:38

Attachments:

@GoogleCodeExporter
Copy link
Author

Well, I went ahead and put it in a new release. I hope it works for everyone.

Original comment by dylankk...@gmail.com on 2 Nov 2008 at 3:24

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Hey Dylan,

I just tried the new release, and it seems to have solved the issue for me.  
Thanks!

Henry

Original comment by henrymal...@gmail.com on 4 Nov 2008 at 6:53

@GoogleCodeExporter
Copy link
Author

I am echoing Henry's sentiment!  You are awesome. . . The newest release solves 
my
issue completely and my maps are back online with WP 2.63 and the latest 
Geo-Mashup
version!

Thank you very much.
Glenn

Original comment by G.E.Sc...@gmail.com on 21 Nov 2008 at 9:03

@GoogleCodeExporter
Copy link
Author

Thanks for reporting back! We'll call it verified and hope that's last of it.

Original comment by dylankk...@gmail.com on 21 Nov 2008 at 9:07

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant