vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   declaring array's (https://vborg.vbsupport.ru/showthread.php?t=78042)

sabret00the 03-13-2005 03:09 PM

declaring array's
 
what's the quickest way to find out which arrays you forgot to declare in a script?

Marco van Herwaarden 03-13-2005 03:51 PM

Rewrite you script and this time decalre all arrays before using them :D

Michael Morris 03-13-2005 03:56 PM

The print_r function will print out all values of an array and it's indeces. But as Marco pointed out, it's good programming practice to declare all variables at the start of the script. I'd also recommend using unset on the variable first to clear out any injected value.

sabret00the 03-13-2005 04:48 PM

gah i know theirs an undefined array in here somewhere but i can't find it :(

this does mean undeclared array right?
PHP Code:

Warningarray_merge() [function.array-merge]: Argument #1 is not an array in \global.php on line 334

Warningarray_merge() [function.array-merge]: Argument #1 is not an array in \global.php on line 376

WarningInvalid argument supplied for foreach() in \includes\functions.php on line 2386 


Marco van Herwaarden 03-13-2005 05:43 PM

Well you are passing a variable that is not an array somewhere where an array is expected, that's for sure.

Did you do a:
PHP Code:

// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array(); 

before calling global?

sabret00the 03-15-2005 09:32 AM

Quote:

Originally Posted by MarcoH64
Well you are passing a variable that is not an array somewhere where an array is expected, that's for sure.

Did you do a:
PHP Code:

// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array(); 

before calling global?

yup always :(

oh well i'll find it it's in one of two scripts so shouldn't be that hard to find.

Brad 03-15-2005 03:06 PM

You used to be able to use non-arrays in array_merge, this changed not to long ago in php and now array_merge only accepts arrays.


All times are GMT. The time now is 08:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02105 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete