Link to home
Start Free TrialLog in
Avatar of wobegone
wobegone

asked on

Warning code on the top of web pages that reads: Warning: array_shift() [function.array-shift]:

The following line of code is appearing on the top of each page of one of my websites, www.paquette-associates.com.

Warning: array_shift() [function.array-shift]: The argument should be an array in /hermes/bosweb/web131/b1316/ipg.penandpixelscom/wordpress/wp-content/themes/platformpro/admin/class.debug.php on line 166

I have gone into the offending file "class_debug.php" but I have no idea of how to fix it.

I have not changed a thing for months on the website and it has been working fine. The theme I used to develop this website is Platform Pro by Pagelines.


<?php
/**
 * 
 *
 *  PageLines Debugging Information Class
 *
 *
 *  @package Platform Framework
 *  @subpackage Includes
 *  @since 1.4.0
 *
 */
class PageLinesDebug {

	// Array of debugging information
	var $debug_info = array();
	
	/**
	 * PHP5 constructor
	 * Use this to build the initial form of the object, before its manipulated by methods
	 *
	 */
	function __construct( ) {
	
		$this->wp_debug_info();
	}
	

	function debug_info_template(){
		
		$out = '';
		foreach($this->debug_info as $element ) {
			
			if ( $element['value'] ) {
				
				$out .= '<h4>'.ucfirst($element['title']).' : '. ucfirst($element['value']);
				$out .= (isset($element['extra'])) ? "<br /><code>{$element['extra']}</code>" : '';
				$out .= '</h4>';
			}
		}
	return $out;		
	}

	// Build all the debug info into an array.

	function wp_debug_info(){
		
		global $wpdb, $wp_version, $platform_build;
		
			// Set data & variables first
			$uploads = wp_upload_dir();
			// Get user role
			$current_user = wp_get_current_user();
			$user_roles = $current_user->roles;
			$user_role = array_shift($user_roles);

		
			// Format data for processing by a template
		
			$this->debug_info[] = array(
				'title'	=> "WordPress Version",
				'value' => $wp_version, 
				'level'	=> false,
			);
		
			$this->debug_info[] = array(
				'title'	=> "Multisite Enabled",
				'value' => ( is_multisite() ) ? 'Yes' : 'No',
				'level'	=> false
			);
		
			$this->debug_info[] = array(
				'title'	=> "Current Role",
				'value' => $user_role,
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Theme Path",
				'value' => '<code>' . TEMPLATEPATH . '</code>',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Theme URI",
				'value' => '<code>' . get_template_directory_uri() . '</code>',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Platform Version",
				'value' => CORE_VERSION,
				'level'	=> false
			);
			$this->debug_info[] = array(
				'title'	=> "Platform Build",
				'value' => $platform_build ,
				'level'	=> false
			);
			$this->debug_info[] = array(
				'title'	=> "PHP Version",
				'value' => floatval( phpversion() ),
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Child theme",
				'value' => ( TEMPLATEPATH != STYLESHEETPATH ) ? 'Yes' : '',
				'level'	=> false,
				'extra' => STYLESHEETPATH . '<br />' . get_stylesheet_directory_uri()
			);

			$this->debug_info[] = array(
				'title'	=> "Ajax disbled",
				'value' => ( get_pagelines_option( 'disable_ajax_save' ) ) ? 'Yes':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "CSS Inline",
				'value' => ( get_pagelines_option( 'inline_dynamic_css' ) ) ? 'Yes':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "CSS Error",
				'value' => ( !get_pagelines_option( 'inline_dynamic_css' ) && !is_multisite() && !is_writable( PAGELINES_DCSS ) ) ? 'File is not writable!':'',
				'level'	=> false
			);


			$this->debug_info[] = array(
				'title'	=> "PHP Safe Mode",
				'value' => ( (bool) ini_get('safe_mode') ) ? 'Yes!':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "PHP Open basedir restriction",
				'value' => ( (bool) ini_get('open_basedir') ) ? 'Yes!':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "PHP Register Globals",
				'value' => ( (bool) ini_get('register_globals') ) ? 'Yes!':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "PHP Magic Quotes gpc",
				'value' => ( (bool) ini_get('magic_quotes_gpc') ) ? 'Yes!':'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "PHP low memory",
				'value' => ( !ini_get('memory_limit') || ( intval(ini_get('memory_limit')) <= 32 ) ) ? intval(ini_get('memory_limit') ):'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Pagelines API",
				'value' => ( !is_array( $this->debug_test_http() ) ) ? 'No' : 'Yes',
				'level'	=> false,
				'extra' => ( is_wp_error( $this->debug_test_http() ) ) ? $this->debug_test_http()->get_error_message() : 'Result: ' . array_shift( json_decode( array_shift( array_splice( $this->debug_test_http(), 1, 1 ) ) ) ) 
			);

			$this->debug_info[] = array(
				'title'	=> "Mysql version",
				'value' => ( version_compare( $wpdb->get_var("SELECT VERSION() AS version"), '5' ) < 0  ) ? $wpdb->get_var("SELECT VERSION() AS version"):'',
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Upload DIR",
				'value' => ( !is_writable( $uploads['path'] ) ) ? "Unable to write to <code>{$uploads['subdir']}</code>":'',
				'level'	=> true,
				'extra' => $uploads['path']
			);

			$this->debug_info[] = array(
				'title'	=> "PHP type",
				'value' => php_sapi_name(),
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "OS",
				'value' => PHP_OS,
				'level'	=> false
			);

			$this->debug_info[] = array(
				'title'	=> "Plugins",
				'value' => $this->debug_get_plugins(),
				'level'	=> false
			);

	}
	

	function debug_get_plugins() {
		$plugins = get_option('active_plugins');
		if ( $plugins ) {
			$plugins_list = '';
			foreach($plugins as $plugin_file) {
					$plugins_list .= '<code>' . $plugin_file . '</code>';
					$plugins_list .= '<br />';

			}
			return ( isset( $plugins_list ) ) ? count($plugins) . "<br />{$plugins_list}" : '';
		}
	}


	// Check wordpress core http fetch is available by querying our own API
	function debug_test_http() {

		if ( $check = get_transient('pagelines_debug_http_check') ) {
			return $check; 
		}
		$debugtest = new WP_Http;
		$body = array( 'version' => CORE_VERSION, 'debug' => true );
		$url = 'http://api.pagelines.com';
		$check = $debugtest->request( $url, array( 'method' => 'POST', 'body' => $body) );
		if ( !is_wp_error($check) && $check['response']['code'] == 200 && $check['response']['message'] == 'OK' ) set_transient( 'pagelines_debug_http_check', $check, 3600 ); // expire 1 hour
		return $check;
	}
//-------- END OF CLASS --------//
}

Open in new window

Picture-1.png
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Couple of things:

1) You should bring this to the attention of the theme developer just so they know what's going on.  

2) Check your wp-config file and make sure it debugging has not been enabled somehow.

3) Check with your ISP (or check directly if you know how) to see if your PHP installation was changed.  Right now, it looks like PHP error reporting is set to report warnings and you probably want to turn that off and only report errors.  This setting is located in the php.ini file
Avatar of wobegone
wobegone

ASKER

Thanks.

I'll  let the theme developer know.

I've attached the code for wp-config and it doesn't appear that the debugging has been enabled by the comment on the bottom, reading

"* For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

I don't think the PHP installation was changed as I also have another website in Wordpress that hasn't been effected but I'll check.

Any more tips you can give me? I really appreciate it.
SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi and thank you WhackAMod and Jason. No plugin has been installed and I'll check with the host as well as anything going on with the theme developer and get back to you.

A really big puzzle:

1) I checked with the Wordpress developer, Pagelines, who says they haven't done anything new.
2) I checked with my website host who said they didn't do anything to the files or any updates.
3) I haven't done anything in months and it was fine just last week when I checked it.

BUT
1) My website host was able to go into the php.ini files to block the error messages from appearing, even though they still show up on the back end.

I'm not sure where to go to fix this and if it's a problem in the long-term that these error messages are still there and may cause trouble.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Jason. I appreciate your time with this. I'm still working on it and I'll let you know what we turn up.
Great advice. I was hoping for an easy fix but in the end, I have to hire someone to go into the files to fix it.