Skip to content

Commit b299ad2

Browse files
tortuetorchetshafer
authored andcommitted
[master] Form method of hidden input '_method' is preserved on next request (LaravelCollective#488)
* Form method of hidden input '_method' is preserved on next request E.G. When you submitted data across a form with a 'PATCH' method and then in a second submit you use a form with a 'DELETE' method, the FormBuilder::getValueAttribute() method use the previous value of the hidden input '_method'. So the value is replaced by 'PATCH' instead of the 'DELETE' value. * Drop PHP 7.1 and add PHP 7.2 in Travis CI config Because Laravel 5.6 require at least PHP 7.1.3 * Fix PHP 7.2 Warning with count() Otherwise a PHP Warning is thrown: count(): Parameter must be an array or an object that implements Countable See http://php.net/manual/en/migration72.incompatible.php#migration72.incompatible.warn-on-non-countable-types * Bump Mockery version to support PHP 7.2
1 parent 050af98 commit b299ad2

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: php
22

33
php:
44
- 7.1
5+
- 7.2
56

67
sudo: false
78

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"require-dev": {
2929
"illuminate/database": "5.6.*",
30-
"mockery/mockery": "~0.9.4",
30+
"mockery/mockery": "~1.0",
3131
"phpunit/phpunit": "~5.4"
3232
},
3333
"autoload": {

src/FormBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ public function getValueAttribute($name, $value = null)
11861186
}
11871187

11881188
$request = $this->request($name);
1189-
if (! is_null($request)) {
1189+
if (! is_null($request) && $name != '_method') {
11901190
return $request;
11911191
}
11921192

@@ -1270,7 +1270,7 @@ public function old($name)
12701270
*/
12711271
public function oldInputIsEmpty()
12721272
{
1273-
return (isset($this->session) && count($this->session->getOldInput()) === 0);
1273+
return (isset($this->session) && count((array) $this->session->getOldInput()) === 0);
12741274
}
12751275

12761276
/**

0 commit comments

Comments
 (0)