File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,8 +132,17 @@ public static function getContentType() {
132132 * @since 1.0
133133 */
134134 public static function getMethod () {
135- $ method = filter_var (getenv ('REQUEST_METHOD ' ), FILTER_SANITIZE_STRING );
136-
135+ $ meth = getenv ('REQUEST_METHOD ' );
136+
137+ if ($ meth === false ) {
138+ $ meth = $ _SERVER ['REQUEST_METHOD ' ];
139+ }
140+ $ method = filter_var ($ meth , FILTER_SANITIZE_STRING );
141+
142+ if ($ method === false ) {
143+
144+ }
145+
137146 if (!in_array ($ method , self ::METHODS )) {
138147 $ method = 'GET ' ;
139148 }
@@ -150,9 +159,17 @@ public static function getMethod() {
150159 public static function getRequestedURL () {
151160 if (self ::get ()->requestedUri === null ) {
152161 $ base = Uri::getBaseURL ();
162+ $ uri = getenv ('REQUEST_URI ' );
153163
154- $ requestedURI = trim (filter_var (getenv ('REQUEST_URI ' )),'/ ' );
155- self ::get ()->requestedUri = $ base .'/ ' .$ requestedURI ;
164+ if ($ uri === false ) {
165+ // Using built-in server, it will be false
166+ $ path = isset ($ _SERVER ['PATH_INFO ' ]) ? $ _SERVER ['PATH_INFO ' ] : '' ;
167+ self ::get ()->requestedUri = $ base .'/ ' .trim (filter_var ($ path ),'/ ' );
168+ } else {
169+ $ requestedURI = trim (filter_var ($ uri ),'/ ' );
170+
171+ self ::get ()->requestedUri = $ base .'/ ' .$ requestedURI ;
172+ }
156173 }
157174
158175
You can’t perform that action at this time.
0 commit comments