From 31e5f9f23437ed74f687469f7ecac84ad9ec277b Mon Sep 17 00:00:00 2001 From: Andrei Mondoc <andreimondoc@gmail.com> Date: Tue, 4 Feb 2020 14:23:12 +0000 Subject: [PATCH] ensure namespace is an exact match Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com> --- wp-rest/Autoloader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-rest/Autoloader.php b/wp-rest/Autoloader.php index dfa95f8a02..0111866615 100644 --- a/wp-rest/Autoloader.php +++ b/wp-rest/Autoloader.php @@ -93,10 +93,10 @@ class Autoloader { */ private function autoload( $class_name ) { - if ( false === strpos( $class_name, $this->namespace ) ) return; - $parts = explode( '\\', $class_name ); + if ( $this->namespace !== $parts[0] ) return; + // remove namespace and join class path $class_path = str_replace( '_', '-', implode( DIRECTORY_SEPARATOR, array_slice( $parts, 1 ) ) ); -- GitLab