From 16aa7318678a8c1634b04afa17680c64ffc87f68 Mon Sep 17 00:00:00 2001 From: Russell Horton Date: Wed, 6 Mar 2013 10:06:35 -0800 Subject: [PATCH] in Swagger.php, use dirname instead of grepping for slash, which could be / or \ --- samples/client/petstore/php/Swagger.php | 2 +- samples/client/wordnik-api/php/wordnik/Swagger.php | 2 +- src/main/resources/php/Swagger.mustache | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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')) {