X-HTTP-METHOD-OVERRIDE not worked. #12478

Closed
aoinall opened this Issue Dec 16, 2016 · 1 comment

Projects

None yet

2 participants

@aoinall
aoinall commented Dec 16, 2016

Expected and Actual Behavior

getMethod In Phalcon\Http\Request,

		if "POST" === requestMethod {
			let headers = this->getHeaders();
			if fetch overridedMethod, headers["X-HTTP-METHOD-OVERRIDE"] {
				let returnMethod = overridedMethod;
			} elseif this->_httpMethodParameterOverride {
				if fetch spoofedMethod, _REQUEST["_method"] {
					let returnMethod = spoofedMethod;
				}
			}
		}

You expects that headers variables contains uppercase "X-HTTP-METHOD-OVERRIDE".
But,

		for name, value in _SERVER {
			if starts_with(name, "HTTP_") {
				let name = ucwords(strtolower(str_replace("_", " ", substr(name, 5)))),
					name = str_replace(" ", "-", name);
				let headers[name] = value;
			} elseif isset contentHeaders[name] {
				let name = ucwords(strtolower(str_replace("_", " ", name))),
					name = str_replace(" ", "-", name);
				let headers[name] = value;
			}
		}

getHeaders method uses ucwords, so returns "X-Http-Method-Override".

Details

  • Phalcon version: > 3.0.0
@sergeyklay sergeyklay added this to the 3.0.3 milestone Dec 16, 2016
@sergeyklay sergeyklay self-assigned this Dec 16, 2016
@sergeyklay
Collaborator

Fixed in the 3.0.x branch.

@sergeyklay sergeyklay closed this Dec 18, 2016
@sergeyklay sergeyklay assigned sergeyklay and unassigned sergeyklay Dec 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment