Skip to content

Conversation

mike-healy
Copy link

PHP 8.1 & 8.2 issue some deprecation notices when using Simple Lightbox.
This fixes those warnings without changing functionality.

@bit9labs
Copy link

👍 Here for this. Let's fix these bugs instead of saying the solution is to turn off deprecation notices.

@@ -498,7 +498,7 @@ function get_key() {
function &add( $id, $properties = array(), $update = false ) {
// Create item
$args = func_get_args();
$ret = call_user_func_array( array( 'parent', 'add' ), $args );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved this with this code:

$ret = parent::add(...func_get_args());

I was coming to see if it was implemented.. but I guess both ways work. Cheers!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, both seem to work. I don't mind updating my PR to that style.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@archetyped do you have a preference, and are you interested in merging this PR?

Copy link

@digitaldonkey digitaldonkey Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this being helpful.

But My IDE wants me to change Return type too:

	/**
	 * Add option to collection
	 * @uses SLB_Field_Collection::add() to add item
	 * @param string $id Unique item ID
	 * @param array $properties Item properties
	 * @param bool $update (optional) Should item be updated or overwritten (Default: FALSE)
	 * @return false|object|SLB_Field Option instance
	 */
	function &add( $id, $properties = array(), $update = false ) {
		// Create item
        $ret = parent::add(...func_get_args());
		return $ret;
	}

@goranb goranb mentioned this pull request Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants