PDA

View Full Version : Odd TRIM warning when editing page


bobbo
09-16-2009, 12:53 PM
I am getting the following error displayed when I try to edit my vba cmps pages.

Warning: trim() expects parameter 1 to be string, array given in [path]\admincp\vba_cmps_admin.php on line 3290


It is displayed right after the Inactive Modules and right before the Usergroup permissions. As a result, the previously set usergroup permissions end up being blank, so it looks like it is failing to retreive the settings from the database due to that error.

Line 3290:
if ((trim($page['userperms']) AND in_array($usergroup['usergroupid'], $page['userperms']))


Anyone ever see this before?

Brian
09-16-2009, 12:55 PM
Does your Admin CP => vBa CMPS => Diagnostics link return any errors?

Our Sponsors
 

bobbo
09-16-2009, 03:41 PM
Hi Bri,

No problems are listed under the cmps diags.

Brian
09-17-2009, 12:29 PM
Ahhh, I see the issue now. That's strange that it's not giving me the error locally or on any of my sites, but the trim() function shouldn't be used there. I've just applied the fix to the admincp/vba_cmps_admin.php file in the download package here, so if you will download the files again and upload the new file that should take care of the issue.
Or if you'd rather apply the fix manually, just look in the file for this code:
if ((trim($page['userperms']) AND in_array($usergroup['usergroupid'], $page['userperms']))
OR $_REQUEST['do'] == 'addpage'
)


And replace with this:
if (in_array($usergroup['usergroupid'], $page['userperms']) OR $_REQUEST['do'] == 'addpage')

Our Sponsors
 

bobbo
09-17-2009, 03:34 PM
Perfect! That fixed it.

Thanks for your help Brian.

behcet
02-22-2010, 04:41 AM
tnx brian

kokoko
04-07-2010, 08:09 AM
thanks brain

ashantycapre
07-13-2010, 08:47 PM
HI!!
If this will be the code:

PHP Code:
if ((trim($page['userperms']) AND in_array($usergroup['usergroupid'], $page['userperms']))
OR $_REQUEST['do'] == 'addpage'
)
And replace with this:
PHP Code:
if (in_array($usergroup['usergroupid'], $page['userperms']) OR $_REQUEST['do'] == 'addpage')
What was the main idea and how can we fix and find solution on this?any contribution?
Thank you!!
how to hypnotize people (http://theartofcoverthypnosis.com/)