Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP Deprecation warnings in PHP8+ #1046

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/class.field_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) {
// Iterate through instances of current placeholder
foreach ( $instances as $instance ) {
// Process value based on placeholder name.
$target_property = $this->util->apply_filters_ref_array( "process_placeholder_${tag}", [ '', $this, &$instance, $layout, $data ], false );
$target_property = $this->util->apply_filters_ref_array( "process_placeholder_{$tag}", [ '', $this, &$instance, $layout, $data ], false );
// Process value using default processors (if necessary).
if ( '' === $target_property ) {
$target_property = $this->util->apply_filters_ref_array( 'process_placeholder', [ $target_property, $this, &$instance, $layout, $data ], false );
Expand Down
2 changes: 1 addition & 1 deletion includes/class.options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?

$ret = call_user_func_array( array( parent::class, 'add' ), $args );
return $ret;
}

Expand Down
2 changes: 2 additions & 0 deletions includes/class.utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,9 @@ public function validate_client_object( $obj, $cmd = null ) {

// Build condition
$sep = '.';
$obj = $obj ? $obj : '';
$obj = trim( $obj, $sep );

// Strip base object
if ( 0 === strpos( $obj, $base . $sep ) ) {
$obj = substr( $obj, strlen( $base . $sep ) );
Expand Down