Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » New Versions, & Updating »

style import causes php error


  #1  
Old Oct 14, 2010, 02:44 PM
Grimmi Meloni
 
5 posts · Oct 2010
Hi,

after some playing around with my local test system, I decided to start installing the soon to be productive wordpress installation. So far I am running

WP 2.9.2
ATA 3.5.3
I have made several changes to the styling on my local installation. To reuse them, I exported them into an ata_XXXX_.txt file. I can also succesfully import this file into the WP installation on my server.

The problem is, that after the import the wordpress installation goes dead, i.e. I only get a blank screen, the HTTP response is zero bytes.

I have checked the logs of the server and I see the following error:

Code:
[Thu Oct 14 21:37:26 2010] [error] [client XXXX ] PHP Fatal error:  Cannot use object of type stdClass as array in /var/www/domain/htdocs/wordpress-2.9.2/wp-content/themes/atahualpa353/functions/bfa_theme_options.php on line 29
As said before - when I do not import the settings, everything is fine. Afterwards things break.

I will also attach the exported style file. Maybe this can help somehow.

Can anybody give me a hint as to what might cause this?

bye, Grimmi
Attached Files
File Type: txt ata-export-20101014.txt (19.0 KB, 1435 views)
  #2  
Old Oct 14, 2010, 05:10 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
ust imported it and it works fine. one difference, I'm on wp 3.0.1 not sure if I have any test 2.9.2 versions around...I'll look
Can you swap back to the defaule theme (go into the Atahualpa folder and rename index.php to index.old - then go to dashboard->appearances->themes and it should switch to the twenty-ten theme) Then rename index.old back to index.php and try activating atahualpa again.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Oct 14, 2010 at 05:14 PM.
  #3  
Old Oct 15, 2010, 01:54 AM
Grimmi Meloni
 
5 posts · Oct 2010
I will try this on the weekend.

Out of interest: What version of PHP is your system running?

I am wondering if it might be a compatiblitiy issue between php versions.

Test system (where everything works): PHP 5.3.3
Prod system (where things fail): PHP 5.2.11 + Suhoshin(?)
  #4  
Old Oct 15, 2010, 10:52 AM
Grimmi Meloni
 
5 posts · Oct 2010
I have started some debugging of this issue. By adding a var_dump like this in line 29:

Code:
$bfa_ata = get_option('bfa_ata4');
echo "<pre>";
var_dump($bfa_ata);
echo "</pre>";
I get an output starting with this for $bfa_ata:

Code:
object(stdClass)#114 (267) {
  ["use_bfa_seo"]=>
  string(2) "No"
  ["homepage_meta_description"]=>
  ...
EDIT:
The output from my dev system for this is:

Code:
array(267) {
  ["use_bfa_seo"]=>
  string(2) "No"
  ["homepage_meta_description"]=>
  string(0) ""
  ...
So, to me it seems like the error message as showed in my initial statement indeed is correct. The result of the get_option call is NOT an array, but an object. So it is reasonable that the following:

Code:
$bfa_ata_widget_areas = $bfa_ata['bfa_widget_areas'];
causes such an error, because it treats $bfa_ata like an array.

That still leaves me wondering why I don't see this on my test system. But at least it seems like this is a bug. Anybody with more PHP/atahualpa development experience who would like to give a statement on this?

OK, taking this further: If I change this to the correct OO syntax, i.e.

Code:
$bfa_ata_widget_areas = $bfa_ata->bfa_widget_areas;
The error is gone. Next error up ahead is:

Code:
[Fri Oct 15 17:42:18 2010] [error] [client 79.196.247.50] PHP Fatal error:  Cannot use object of type stdClass as array in /var/www/vierpfeile/htdocs/wordpress-2.9.2/wp-content/themes/atahualpa353/functions/bfa_get_options.php on line 526
There I can see the same problem. But in fact, the whole code uses the array syntax on $bfa_ata. So I do not believe that this is the real problem.

Question: Given the very "mutating" history of PHP - Does anybody know if this is another episode of the ever-changing PHP??? Maybe there's some kind of switch that forces my production system to behave like this?

BTW - now that I am back in front of the system: The exact version of the prod system's php is:

PHP Version 5.2.12-pl0 with suhosin 0.9.7

Maybe there are some known issues with this combination?

Last edited by Grimmi Meloni; Oct 15, 2010 at 10:55 AM.
  #5  
Old Oct 16, 2010, 07:23 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Well I just went back and did a test on a WP 2.9.2 and Atahualpa 3.5.3 and export/import works fine. This is with php 5.2.9

I added the
HTML Code:
echo "<pre>";
var_dump($bfa_ata);
echo "</pre>";
and I get an Array out.

So it seems that this is an environment issue. On one of your systems (and on two of mine), the line
HTML Code:
$bfa_ata = get_option('bfa_ata4');
returns an array and on the other it returns an object.

so we have
php 5.2.9 - returns an array
php 5.2.12-pl0 - returns an object
php 5.2.13 - returns an array
php 5.3.3 - returns an array
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Oct 18, 2010, 01:44 PM
Grimmi Meloni
 
5 posts · Oct 2010
Thanks for investigating, Juggledad.

To be more precise, we have
Quote:
Originally Posted by juggledad
php 5.2.9 - returns an array
php 5.2.12-pl0 with suhosin - returns an object
php 5.2.13 - returns an array
php 5.3.3 - returns an array
So, to me the most likely culprit is suhosin. I will try to check this out further and report my findings.
  #7  
Old Oct 18, 2010, 03:52 PM
Grimmi Meloni
 
5 posts · Oct 2010
OK, seems I am homing in.

We tried php 5.3.3 on the server - with and without suhosin. Seems like it is not to blame afterall.

So what I did next, was to import the DB Dump from the non working productive system to my test system. And I got the problem reproduced locally.

OK, so it is the DB contents. My best guess is, that the theme uses the entry "bfa_ata4" in table wp_options, correct? I did a diff of my working DB dump and the non working dump. Looking specifically at the bfa_ata4 entry.

And look what I found:

working dump starts with:
Code:
(185,0,'bfa_ata4','a:267:{s:11:\"use_bfa_seo
non working dump start with
Code:
(137,0,'bfa_ata4','O:8:\"stdClass\":267:{s:11:\"use_bfa_seo
I am pretty sure this is the culprit. So question from my side is: Which part of PHP is in control of how these settings are serialized into the DB? (I am guessing this is a serialized form as it seems that the first field is defining the data type that follows....).

Interesting though: I tried to fix the prod system manually, by exchanging the O:8:\"stdClass\" with a simple "a" like it is present in the working dump. That made the system work again, but the theme displayed only its standard values. Probably the serialization cannot be fixed that easily.

Anyway, here comes the interesting part: Due to the testing with and without the suhosin, we are now on PHP 5.3.3 on the prod server. So out of curiosity I did another import. And now everything works, and YES, the import now created a serialized version of the bfa_ata4 like it is on my test machine.

For me the issue is therefore solved. If someone has an idea as to why this strange version of the bfa_ata4 might have ended up in my DB, I would love to hear you out.

Thanks for the support.
Grimmi

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected '<' in the functions.php file pingitt Atahualpa 3 Wordpress theme 6 Mar 12, 2013 04:52 AM
What exactly gets wiped out if i import the ata-round.txt style? RuBeQK Header configuration & styling 8 Jul 28, 2010 11:45 AM
3.51 Style Import Not Working Today LaneLester Atahualpa 3 Wordpress theme 6 Jun 29, 2010 04:04 PM
PHP Catchable fatal error: themes/atahualpa/functions/bfa_meta_tags.php on line 169 Shamisen Plugins & Atahualpa 0 Apr 6, 2010 11:43 PM
[SOLVED] Error in PHP Coding Using PHP Text Widget rnimchuk Sidebars & Widgets 2 Oct 28, 2009 01:26 PM


All times are GMT -6. The time now is 05:35 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.