GetSimple Support Forum
array_key_exists ERROR updating to GS 3.2.1 - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: array_key_exists ERROR updating to GS 3.2.1 (/showthread.php?tid=4739)



array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-05-13

Updating my site from GS 3.2.0 to GS 3.2.1
at line of my template
PHP Code:
echo date('j/m/y',strtotime(returnPageField('namepage','pubDate'))); 
it shows this message:
PHP Code:
Warningarray_key_exists() [function.array-key-exists]:
The second argument should be either an array or an object in
D
:\Inetpub\webs\my_site\admin\inc\caching_functions.php on line 114 

Any help?


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-05-13

Where in your template is this, so i can reproduce.

Also does namepage exist ? Is that the exact code ? and only error ?


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

Hi again shawn,
then I waited and I tried even with the new GS version 3.2.3 but nothing to do, it shows the same error...
PHP Code:
Warningarray_key_exists() [(function.array-key-exists)]:
The second argument should be either an array or an object in
D
:\Inetpub\webs\my_site\admin\inc\caching_functions.php on line 52 
at these lines....
PHP Code:
<?php getPageField($pagina,'pubDate'); ?>
<?php getPageField
($pagina,'title'); ?>
<?php getPageField
($pagina,'metad'); ?>
but weirdly not on this line...
PHP Code:
<?php getPageField($pagina,'content'); ?>
Instead wirg gs version 3.2.0 I have no problem.
Any help???


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-02

If I had to guess $pagina is not set to anything.


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

Ah no sorry, that is one of my last try....
The real lines are these...
PHP Code:
<?php getPageField('centerfold','pubDate'); ?>
<?php getPageField
('centerfold','title'); ?>
<?php getPageField
('centerfold','metad'); ?>
I am very desperate because everything was okay with version 3.2.0 and now it's gonna be a puzzle..
Of course "centerfold" is an existing page and it is not a private one.


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-02

and where is this code?

and do you have debug mode on ?


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

No.
In my gsconfig it is disabled
Code:
# Turn on debug mode
#define('GSDEBUG', TRUE);
and if I turn it on, it gives me the same error message:
Code:
Warning: array_key_exists() [(function.array-key-exists)]:
The second argument should be either an array or an object in
D:\Inetpub\webs\my_site\admin\inc\caching_functions.php on line 52



RE: array_key_exists ERROR updating to GS 3.2.1 - Carlos - 2013-10-02

What if you add
Code:
define('GSSUPPRESSERRORS', true);



RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

Nothing to do, Carlos.
Always the same song :-(


RE: array_key_exists ERROR updating to GS 3.2.1 - Carlos - 2013-10-02

Shawn asked you where's your code. Template, component, plugin...?


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

Oh right! They are directly in my template.
Only with the "content" it doesn't give me problems!


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-02

I need to know exactly where the code is in your template. Between what functions etc, get header called first ?
etc.

I need to know with debug mode on ALL notices and warnings. Is there a notice before that warning?

And are you absolutely sure that that slug exists that you are calling for ?


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-02

For now, here is the core of the code...

PHP Code:
<div id="content">
<
div class="content_item">

<
div class='news'>Last News</div>
<?
php $page='centerfold'$data='pubDate'?>

<h1><?php getPageField($page,'title'); ?></h1>
<h2><?php getPageField($page,'metad'); ?></h2>
<?php getPageField($page,'content'); ?>

<?php include('boxes.inc.php'); ?>

<?php if (isset($_GET['post']) || "" ) { echo "<p class='copyright'>&copy; All rights reserved.</p>"; } ?>

</div><!--close content_item-->
</div><!--close content--> 



RE: array_key_exists ERROR updating to GS 3.2.1 - Carlos - 2013-10-03

I have tried using getPageField with non-existing slugs and the error I get (a notice) is different.
After experimenting a bit, I got D.O.'s error by inserting this in the sidebar:

Code:
<?php
global $pagesArray;
$pagesArray = NULL;
getPageField('page','title');
?>

It's like $pagesArray isn't being populated or something in D.O.'s site.


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-03

I get the same error he gets with debugging on for non existing slug.

Notice: Undefined index: centerfold in /hsphere/local/home/salverso/dev.tablatronix.com/getsimple/develop/admin/inc/caching_functions.php on line 52

Warning: array_key_exists(): The second argument should be either an array or an object in /hsphere/local/home/salverso/dev.tablatronix.com/getsimple/develop/admin/inc/caching_functions.php on line 52

Like I said without knowing where this code is, cannot really determine if pages array is populated or not, cannot eliminate that either. I have yet to see where this code is located. WHAT FILE ?


RE: array_key_exists ERROR updating to GS 3.2.1 - Carlos - 2013-10-03

I think I found it.
D.O., could it be you upgraded by uploading only the admin folder, and did not upload the root index.php file?


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-03

Yes Carlos I copy the admin folder of the new gs version via FTP.

what index file? In the admin folder?


(2013-10-03, 01:43:03)Carlos Wrote: I think I found it.
D.O., could it be you upgraded by uploading only the admin folder, and did not upload the root index.php file?



RE: array_key_exists ERROR updating to GS 3.2.1 - Carlos - 2013-10-03

No, the one in the root, outside admin.
Upgrading is uploading:
index.php
admin/*


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-03

A moment, I am gonna test it.


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-03

You rock Carlos, it was my fault. Thanks to you and Shawn. Problem fixed.


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-03

The entire zip needs to be extracted over your site for upgrades.

ughh, this keeps popping up.
Perhaps we should checksum this file or version it ?

Maybe even get rid of it, or make it so it includes and never ever changes.


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-03

Hi Shawn,
As I said I copied only the admin folder without index.php because I didn't want to overwrite other important folders of my site.
Most probably, Carlos figured out my wrong "steps".
About your idea, I like it: index.php should includes another file in the admin folder, just to avoid problems like this.
The Problem is fixed.
Thanks for your help!


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-03

Yeah I know, this is in the forums like 3 times, same problem.

I do not even know if we have upgrade instructions in our readme or distro for that matter. Something we probably need to focus on before any more code changes.


RE: array_key_exists ERROR updating to GS 3.2.1 - shawn_a - 2013-10-03

Well the wiki clearly says
http://get-simple.info/wiki/installation:upgrade

"If you don't want to overwrite everything because for instance you have customised or edited your old files or themes then the minimum you need to upload is the folder /admin/ and the file index.php ."

For now, I will just add that verbatim to the readme as well and a link to it, since the readme only has install instructions.

Then start thinking about adding index to health check somehow, or removing code from it.


RE: array_key_exists ERROR updating to GS 3.2.1 - D.O. - 2013-10-04

The fact that everything was working fine confused me, so I didn't realize that it could depend from the index.php file
:-D