Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-07-2005, 12:00 PM
reteep reteep is offline
 
Join Date: Mar 2004
Location: Germany
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php5 and the change of array_merge

Hey there,

Quote:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /*/vb/includes/init.php on line 522
It's a common Error for people (like me) who are running php5 and lots of hacks are affected.

Now I searched through the forum and found lots of topics about it, however there's no common fix so far.

In fact it should be possible to replace all that array_merge functions with the new one, isn't it? How would that look like by example?
Reply With Quote
  #2  
Old 01-07-2005, 12:09 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

actually the fix is very easy:

make sure all your files have

PHP Code:
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// 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 they call global.php
Reply With Quote
  #3  
Old 01-07-2005, 12:13 PM
reteep reteep is offline
 
Join Date: Mar 2004
Location: Germany
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh, good to know.

Thanks for your post!
Reply With Quote
  #4  
Old 01-07-2005, 12:32 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

keine ursache
Reply With Quote
  #5  
Old 01-07-2005, 11:42 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aber hacks vielleicht hat andere array's dass array_merge gebrauchen, aber nicht eine "if (!is_array($neededarray))" hat?

Ok, now you probably understand why I only get a C in german.

But hacks possibly have other arrays that uses the array_merge, but don't have an "if (!is_array($neededarray))"?
Reply With Quote
  #6  
Old 01-08-2005, 11:59 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Fillip: don't ask who i got in english classes ^^
Reply With Quote
  #7  
Old 01-26-2005, 10:59 AM
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Location: UK
Posts: 842
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for jumping in on someone elses thread........... but interesting read.

I did not think that PHP 5 causes problems like this. I have been scratching my head for days and then I read this post.

I have a similar problem as follows:

I installed a few hacks and all was fine until I noticed errors are the top of some pages. This error below is from the top of my arcade hack:

Quote:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /global.php on line 376

Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 2188
Is this problem with PHP 5 cos Im running 5.0.3 thats causing my errors? and if so how do I fix it.

Regards.

Quote:
Originally Posted by Xenon
actually the fix is very easy:

make sure all your files have

PHP Code:
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// 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 they call global.php
Well I be bugger

Placed the code above that Xenon posted in my global and functions php files ane the errors are now gone and all is working.

Where else should I place this code?

Thanks
Reply With Quote
  #8  
Old 01-26-2005, 11:25 AM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Declaring Variables before using them? What a novel idea!
Reply With Quote
  #9  
Old 01-26-2005, 11:52 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
Declaring Variables before using them? What a novel idea!
why do i always find the worst jokes so hilarious.
Reply With Quote
  #10  
Old 01-26-2005, 12:01 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
why do i always find the worst jokes so hilarious.
I just have this sick sense of humor and sitting here alone I amuse myself by pointing out the obvious.

If you are a C programmer it might be funny.

No ill intent meant. Just amusing myself.

To be more on topic while I'm having fun, this is usually a hot topic, talking about declaring variables. I found alot of debate on the subject, some very amusing, when after using C for a long time, I had a need to mod some Visual Basic code.

Well off I went and got vB6 and a book. Installed it and did some set up. Now if you have a C background, you can't help yourself, you declare variables, there's no way around it. So I set up the code to not allow dynamic declaration of variables and attemped a complie. It did nothing but complain. Nothing was declared. So to mod this huge piece of code I just removed the statement that made the compiler force declarations. And I was off to delveoping all the bad habits C programmers joke about.

Now I use php, same thing, back to bad habits. Opps, I need a variable here and bam, there it is. I do try to init variables usually, but If you look at any code I wrote, I'm inconsistant. SO part of the amusment above was on myself, I know better and don't do it.

So now php 5 seems to need Array() declared/initialized for this function to accept them. Are we going to declarations in php as a whole? Isn't there a performance benefit to delcaration and proper address space allocated without the compiler having to dynamically sort out types?

I don't hang out at php.net or anywhere that discusses such things, so this thread has sparked my curiousity.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:15 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04298 seconds
  • Memory Usage 2,269KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete