Hi,
I want to ask if somebody receive the same warning on the server (the file is from WordPress himself: wp-includes/functions.php)
[Wed Jul 27 08:57:57.387656 2016] [fcgid:warn] [pid 16338] [client me IP server] mod_fcgid: stderr: PHP Warning: in_array() expects parameter 2 to be array, string given in /var/www/vhosts/theme.com/httpdocs/wp-includes/functions.php on line 574
Even if I installed again the WordPress (last version) receive the same warning.
the snippet in wp-includes/functions.php is:
foreach ( (array) $post_links_temp as $link_test ) {
if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
$test = @parse_url( $link_test );
if ( false === $test )
continue;
if ( isset( $test['query'] ) )
$post_links[] = $link_test;
elseif ( isset($test['path']) && ( $test['path'] != '/' ) && ($test['path'] != '' ) )
$post_links[] = $link_test;
}
}
and second line is causing the warning.
Hello nairolf2013,
First of all, please try to make a new clean install, without any untested plugins, leave just Visual Composer to active, clear all your caches and install only the plugins that come bundled with our theme and rule out the conflicting plugins and check the results. Please notice that this issue is not theme related and if your problem is still there after these, you will have to find some online solutions or you can contact the WordPress stuff because they should be able to provide a more accurate response.
Thanks for your understanding!
and only this modifications:
– in the index.php we put this snippet because we get errors “PHP Fatal error: Call to undefined function get_header()…. on line 6”:
if (function_exists('get_header')) {
get_header();
}else{
/* Redirect browser */
header("Location: http://theme.com/ ");
/* Make sure that code below does not get executed when we redirect. */
exit;
};
– and in htaccess:
/*CHRISTOPHER's CUSTOM MODS - 1.10.15 rev15A - (c) 2010-2015 Chris Simmons */
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action('wp_head','print_emoji_detection_script',7);
remove_action('wp_print_styles','print_emoji_styles');
function no_errors_please(){
return 'You appear to be up to no good. Please stop now!';
}
add_filter( 'login_errors', 'no_errors_please' );
/* Disable YOAST SEO Admin Bar. */
function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wpseo-menu');
}
// and we hook our function via
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
function delete_enclosure(){
return '';
}
add_filter( 'get_enclosed', 'delete_enclosure' );
add_filter( 'rss_enclosure', 'delete_enclosure' );
add_filter( 'atom_enclosure', 'delete_enclosure' );
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
add_action('init', 'myoverride', 100);
function myoverride() {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}
function dequeue_visual_composer_css() {
if (is_single()) {
wp_dequeue_style('js_composer_front');
}
}
add_action('wp_enqueue_scripts', 'dequeue_visual_composer_css', 1003);
Hello nairolf2013,
This issue happens when the index.php file is called directly. Something that would not normally happen when browsing a site, only found by crawlers which find all of the possible Url’s in a site. Please follow these 2 links.
https://ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/
https://forum.tagdiv.com/topic/a-few-errors/
Thank you!
Hi Catalin,
I think that you lost the thread. I give you the modifications (htaccess & index.php), because I think that maybe can produce the warning into wp-includes/functions.php
So, my question was about “wp-includes/functions.php” and not the topic index.php which by the way, I’ve opened near 2 weeks ago
Hi,
The error is caused by the return of the get_enclosed() function – http://screencast.com/t/PdcexNriw
It should return an array but for some reason it doesn’t – http://screencast.com/t/bvASC05vR3m
The get_enclosed() function is described here – https://codex.wordpress.org/Function_Reference/get_enclosed
The do_enclose() function is described here – https://codex.wordpress.org/Function_Reference/do_enclose
You could try to find the post on which this happens, this can be done by adding a check on $pung to echo something when $pung is not an array.
You can also try to switch the theme with a default one (ex. Twenty Fifteen) to see if the theme has some influence on this behavior.
Another check is to remove the custom code from functions.php and see if the error is still there.
If this doesn’t help please send us an email at contact@tagdiv.com , include a link to this conversation and provide wp-admin and ftp access so we can take a look.
Thank you!
