• Resolved rftbdev

    (@rftbdev)


    Attempt to read property “ID” on array in /wp-content/plugins/events-manager/em-events.php

    $posts = EM_Events::get(array(‘scope’ => ‘future’), false); is the code that makes the error appear?

    any help is greatly appreciated

    function being effected :

    /**
     * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
     * @param string $data
     * @return string
     */
    function em_wp_the_title($data, $id = null){
    	global $post, $wp_query, $EM_Location, $EM_Event;
    	if( empty($post) ) return $data; //fix for any other plugins calling the_content outside the loop
    	//because we're only editing the main title of the page here, we make sure we're in the main query
    	if( is_main_query() && $id == $post->ID ){
    	    $events_page_id = get_option ( 'dbem_events_page' );
    	    $locations_page_id = get_option( 'dbem_locations_page' );
    	    $edit_events_page_id = get_option( 'dbem_edit_events_page' );
    	    $edit_locations_page_id = get_option( 'dbem_edit_locations_page' );
    	    $edit_bookings_page_id = get_option( 'dbem_edit_bookings_page' );
    		if( !empty($post->ID) && in_array($post->ID, array($events_page_id, $locations_page_id, $edit_events_page_id, $edit_locations_page_id, $edit_bookings_page_id)) ){
    			if ( $wp_query->in_the_loop ) {
    				return apply_filters('em_wp_the_title', em_content_page_title($data, $id)) ;
    			}
    		}elseif( is_single() && !empty($post->post_type) ){
    			if( $post->post_type == EM_POST_TYPE_EVENT ){
    				$EM_Event = em_get_event($post);
    				return apply_filters('em_wp_the_title', $EM_Event->output($data)) ;
    			}elseif( $post->post_type == EM_POST_TYPE_LOCATION ){
    				$EM_Location = em_get_location($post);
    				return apply_filters('em_wp_the_title', $EM_Location->output($data)) ;
    			}
    		}
    	}
    	return $data;
    }
    add_filter ( 'the_title', 'em_wp_the_title',10, 2 );
    • This topic was modified 2 years ago by rftbdev.
    • This topic was modified 2 years ago by rftbdev.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter rftbdev

    (@rftbdev)

    UPDATE: warnings are present on php versions 8.1.9 and 8.0
    warnings not present on php version 7.4.1

    UPDATE 2: I reset the plugin settings, warnings still present. WP_Debug in wp-config.php is set to false.

    • This reply was modified 2 years ago by rftbdev.
    Thread Starter rftbdev

    (@rftbdev)

    UPDATE 3: WARNINGS STILL PRESENT, TEMPLATE FUNCTIONING AS INTENDED. CONTENT BEING INJECTED IN FOOTER OF PAGE, SAME ERROR AS STATED IN ORIGINAL POST

    Thread Starter rftbdev

    (@rftbdev)

    thank you: https://aristath.github.io/blog/wp-hide-php-errors

    I am developing a site using Events Manager plugin on Local WP, WordPress version 6.1, PHP version 8.1.9

    EnvisionDesign

    (@envisiondesign)

    Looking at their most recent changelog it makes some reference to php 8.1

    I’m trying to get an answer before having to buy another license just to find out that it does work.

    https://wp-events-plugin.com/blog/2022/10/15/events-manager-6-1-2-and-pro-3-1-2/

    Cheryl

    (@tricheryltops)

    Hi,
    I’m following this thread because I’m seeing numerous warnings in my log like:

    PHP Warning: Attempt to read property “ID” on int…
    referring to line 297 in em-events.php.

    I am also using PHP8.1

    Thanks

    Same here:
    Attempt to read property “ID” on int in […]/plugins/events-manager/em-events.php on line 292

    PHP Version 8.1.19

    Can you please fix this annoying warning?

    thanks,
    Davide.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Attempt to read property “ID” on array PHP version > 8.0’ is closed to new replies.