Co-Authors-Plus icon indicating copy to clipboard operation
Co-Authors-Plus copied to clipboard

Guarantee that $wp_query->queried_object_id is an integer

Open Biont opened this issue 5 years ago • 1 comments

You're changing the default queried_object_id on authors pages to the guest author's ID here. At least on my test environment, this is now a string, which conflicts with the declared type of that field which should be an integer:

	/**
	 * The ID of the queried object.
	 *
	 * @since 1.5.0
	 * @var int
	 */
	public $queried_object_id;

So any code that uses it and relies on the value to be an integer is now prone to throwing a fatal (which is further amplified by static type-hinting becoming more ubiquitous).

Please cast this to (int) before setting the variable.

Biont avatar Jan 30 '19 12:01 Biont

@Biont Hi there! Thanks for reporting this -- feel free to open up a PR with steps on reproducing.

rebeccahum avatar Jan 30 '19 18:01 rebeccahum