The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Argument Problem
digitalplace
post Dec 27 2007, 08:40 AM
Post #1





Group: Members
Posts: 3
Joined: 27-December 07
Member No.: 4,590



I am working with a nonprofit to have them update their website. I found a webiste for them called synthasite that is a full html WYSIWYG editor that works well and lets you download the content to post on your own domain. The problem is that I am getting an error on the website. I will post the following:

ERROR:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/mmpnweb7/public_html/beta2/classes/commons/includes/Common.inc.php on line 108

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/mmpnweb7/public_html/beta2/classes/commons/includes/Common.inc.php on line 108

Warning: Invalid argument supplied for foreach() in /home/mmpnweb7/public_html/beta2/classes/commons/includes/SmartyInit.inc.php on line 22

Warning: Invalid argument supplied for foreach() in /home/mmpnweb7/public_html/beta2/classes/commons/lib/smarty_plugins/function.includes.php on line 12

Warning: Invalid argument supplied for foreach() in /home/mmpnweb7/public_html/beta2/classes/commons/lib/smarty_plugins/function.includes.php on line 22

LOCATION:
http://beta2.chilict.com/

FILE Info from Common.inc.php:
foreach ($GLOBALS as $key => $value) {
if (in_array($key, $allowed) || !isset ($GLOBALS[$key]))
continue;
unset ($GLOBALS[$key]);


My PHP is version 5.2.4 and confirmed here: http://beta2.chilict.com/phpversion.php

Any help would be helpful.

Thank you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Dec 27 2007, 10:12 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Quick answer to an argument problem is just to agree with the other person. Just don't argue.

Meanwhile, in the fragment above, $allowed is obviously meant to be an array of the globals that are allowed (whatever that is, in context), but presumably isn't. Perhaps it got lost. Start by using print_n($allowed); to find out what it is.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
digitalplace
post Dec 27 2007, 02:23 PM
Post #3





Group: Members
Posts: 3
Joined: 27-December 07
Member No.: 4,590



This is more of that code snippet. I am not sure where you are recommending I put in the print_n($allowed) code.

*************************

/************************************************
* Using register_globals opens up a wide
* variety of attacks on pages (this feature
* is disabled by default since PHP 4.2)
************************************************/

if (ini_get('register_globals')) {
if (isset ($_REQUEST['GLOBALS'])) {
die("GLOBALS overwrite attempt detected");
}

$allowed = array (
'GLOBALS',
'_FILES',
'_COOKIE',
'_POST',
'_GET',
'_SERVER',
'_ENV',
'_SESSION'
);

foreach ($GLOBALS as $key => $value) {
if (in_array($key, $allowed) || !isset ($GLOBALS[$key]))
continue;
unset ($GLOBALS[$key]);
}
}
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Dec 27 2007, 02:36 PM
Post #4


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/mmpnweb7/public_html/beta2/classes/commons/includes/Common.inc.php on line 108

This error message means that the second argument to in_array() is the wrong type. Since it should be an array, this almost certainly means it isn't. In the new snippet you have shown, $allowed is defined as an array, so there should be no problem; but we don't know if this is actually line 108 of the file mentioned above, or what.

Unfortunately it simply isn't feasible to debug a program by being shown fragments of it, unless the problem is _extremely_ simple. We also don't understand how you came to have the collection of files you have - which may be incomplete, corrupted or whatever. We also don't know what documentation there is with the program.

And anyway this chunk of code is some generic "safety device" which isn't necessary if you have switched off the globals thingie anyway.

Bottom line is that if you have acquired a big chunk of stuff, and it just doesn't work like this, you either need to (a) throw it away and start with something else, or (b) learn programming, or © pay someone to sort it out for you (but they might choose (a) anyway).

Hope this helps.


The problem is that you are trying to debug a program without even
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
digitalplace
post Dec 27 2007, 04:15 PM
Post #5





Group: Members
Posts: 3
Joined: 27-December 07
Member No.: 4,590



As you stated I seem to know enough that I am dangerous. I do appreciate your help though. On a hunch I remmed out the following:

$allowed = array (
/*****

'GLOBALS',
'_FILES',
****/
'_COOKIE',
'_POST',
'_GET',
'_SERVER',
'_ENV',
'_SESSION'
);

This seems to have fixed the problem. As for the code I had the site from www.synthasite.com which is suppose to allow you to create an online website and then download the code to post to on your own domain.
I appreciate your help and time.

Thank you and happy holidays.

Michael
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 01:24 PM