From e3ae00e763000a1661e7ba0e97a206468722f475 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Mon, 8 Nov 2010 18:37:54 +0000 Subject: [PATCH] Compatibility if missing property_exists(). Fixes issue 554. git-svn-id: http://yourls.googlecode.com/svn/trunk@550 12232710-3e20-11de-b438-597f59cd7555 --- includes/functions-compat.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/functions-compat.php b/includes/functions-compat.php index 5ee31af..e593e7f 100644 --- a/includes/functions-compat.php +++ b/includes/functions-compat.php @@ -138,3 +138,14 @@ function bcpow( $base, $power ) { } } +// Replacement for property_exists() (5.1+) +if ( !function_exists( 'property_exists' ) ) { + function property_exists( $class, $property ) { + if ( is_object( $class ) ) { + $vars = get_object_vars( $class ); + } else { + $vars = get_class_vars( $class ); + } + return array_key_exists( $property, $vars ); + } +} -- 2.45.0