Skip to content

Commit 89647a5

Browse files
Minor fixes around parse_url() checks
1 parent 7111520 commit 89647a5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

AbstractUriElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(\DOMElement $node, ?string $currentUri = null, ?stri
4646
$this->method = $method ? strtoupper($method) : null;
4747
$this->currentUri = $currentUri;
4848

49-
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
49+
$elementUriIsRelative = !parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
5050
$baseUriIsAbsolute = null !== $this->currentUri && \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
5151
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
5252
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the "%s" class ("%s" was passed).', __CLASS__, $this->currentUri));

Form.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,8 @@ public function getUri()
203203
$uri = parent::getUri();
204204

205205
if (!\in_array($this->getMethod(), ['POST', 'PUT', 'DELETE', 'PATCH'])) {
206-
$query = parse_url($uri, \PHP_URL_QUERY);
207206
$currentParameters = [];
208-
if ($query) {
207+
if ($query = parse_url($uri, \PHP_URL_QUERY)) {
209208
parse_str($query, $currentParameters);
210209
}
211210

0 commit comments

Comments
 (0)