• Andreas

    (@stylingagenten)


    Hi,

    I have been trouble shooting why we do receive error log on the server everytime the customer visit a category on our site.

    The error is like this:

    [STDERR] PHP Warning: Undefined array key “default” in /xxx.com/public_html/wp-includes/class-wp-list-util.php on line 170

    Here is line 170 in that file:

    $newlist[ $key ] = $value[ $field ];

    Here is that part of the script:

    /**
    	 * Plucks a certain field out of each element in the input array.
    	 *
    	 * This has the same functionality and prototype of
    	 * array_column() (PHP 5.5) but also supports objects.
    	 *
    	 * @since 4.7.0
    	 *
    	 * @param int|string $field     Field to fetch from the object or array.
    	 * @param int|string $index_key Optional. Field from the element to use as keys for the new array.
    	 *                              Default null.
    	 * @return array Array of found values. If $index_key is set, an array of found values with keys
    	 *               corresponding to $index_key. If $index_key is null, array keys from the original
    	 *               $list will be preserved in the results.
    	 */
    	public function pluck( $field, $index_key = null ) {
    		$newlist = array();
    
    		if ( ! $index_key ) {
    			/*
    			 * This is simple. Could at some point wrap array_column()
    			 * if we knew we had an array of arrays.
    			 */
    			foreach ( $this->output as $key => $value ) {
    				if ( is_object( $value ) ) {
    					$newlist[ $key ] = $value->$field;
    				} elseif ( is_array( $value ) ) {
    					$newlist[ $key ] = $value[ $field ];
    				} else {
    					_doing_it_wrong(
    						__METHOD__,
    						__( 'Values for the input array must be either objects or arrays.' ),
    						'6.2.0'
    					);
    				}
    			}
    
    			$this->output = $newlist;
    
    			return $this->output;
    		}

    When I have your plugin activated the error starts on the server log, when I deactivate your plugin it goes away. Please look at why this occur.

    The page I need help with: [log in to see the link]

  • The topic ‘Your plugin seems to generate a wordpress error log’ is closed to new replies.