diff --git a/samples/client/petstore/php/Swagger.php b/samples/client/petstore/php/Swagger.php index e314eeeec7f..102d2e918fb 100644 --- a/samples/client/petstore/php/Swagger.php +++ b/samples/client/petstore/php/Swagger.php @@ -11,7 +11,7 @@ * @param string $className the class to attempt to load */ function swagger_autoloader($className) { - $currentDir = substr(__FILE__, 0, strrpos(__FILE__, '/')); + $currentDir = dirname(__FILE__); if (file_exists($currentDir . '/' . $className . '.php')) { include $currentDir . '/' . $className . '.php'; } elseif (file_exists($currentDir . '/models/' . $className . '.php')) { diff --git a/samples/client/wordnik-api/php/wordnik/Swagger.php b/samples/client/wordnik-api/php/wordnik/Swagger.php index 3f86931c640..c8fd8e2feea 100644 --- a/samples/client/wordnik-api/php/wordnik/Swagger.php +++ b/samples/client/wordnik-api/php/wordnik/Swagger.php @@ -11,7 +11,7 @@ * @param string $className the class to attempt to load */ function swagger_autoloader($className) { - $currentDir = substr(__FILE__, 0, strrpos(__FILE__, '/')); + $currentDir = dirname(__FILE__); if (file_exists($currentDir . '/' . $className . '.php')) { include $currentDir . '/' . $className . '.php'; } elseif (file_exists($currentDir . '/models/' . $className . '.php')) { diff --git a/src/main/resources/php/Swagger.mustache b/src/main/resources/php/Swagger.mustache index 37da9c29f83..93f8e7144fa 100644 --- a/src/main/resources/php/Swagger.mustache +++ b/src/main/resources/php/Swagger.mustache @@ -11,7 +11,7 @@ * @param string $className the class to attempt to load */ function swagger_autoloader($className) { - $currentDir = substr(__FILE__, 0, strrpos(__FILE__, '/')); + $currentDir = dirname(__FILE__); if (file_exists($currentDir . '/' . $className . '.php')) { include $currentDir . '/' . $className . '.php'; } elseif (file_exists($currentDir . '/models/' . $className . '.php')) {