Skip to content

Deprecated Function  #184

Open
Open
@sshea-ws

Description

Hello,

Please review and fix.

create_function() is deprecated in setup.php on line 14

`
$newfunc = create_function( '', '
global $chery_core_version;

$path = trailingslashit( dirname( __FILE__ ) ) . \'cherry-core.php\';

$data = get_file_data( $path, array(
	\'version\' => \'Version\'
) );

if ( isset( $data[\'version\'] ) ) {
	$version = $data[\'version\'];
}

$old_versions = null;

if ( null !== $chery_core_version ) {
	$old_versions = array_keys( $chery_core_version );
}

if ( is_array( $old_versions ) && isset( $old_versions[0] ) ) {
	$compare = version_compare( $old_versions[0], $version, \'<\' );

	if ( $compare ) {
		$chery_core_version = array();
		$chery_core_version[ $version ] = $path;
	}
} else {
	$chery_core_version = array();
	$chery_core_version[ $version ] = $path;
}

' );`

Issue fixed

`return function () {
global $chery_core_version;

$path = trailingslashit( dirname( __FILE__ ) ) . 'cherry-core.php';

$data = get_file_data( $path, array(
	'version' => 'Version'
) );

if ( isset( $data['version'] ) ) {
	$version = $data['version'];
}

$old_versions = null;

if ( null !== $chery_core_version ) {
	$old_versions = array_keys( $chery_core_version );
}

if ( is_array( $old_versions ) && isset( $old_versions[0] ) ) {
	$compare = version_compare( $old_versions[0], $version, '<' );

	if ( $compare ) {
		$chery_core_version = array();
		$chery_core_version[ $version ] = $path;
	}
} else {
	$chery_core_version = array();
	$chery_core_version[ $version ] = $path;
}

};
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions