[5.6] Change Resource name away from soft-reserved name #22969
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an issue that was identified by @joshuanoyes in an Internals post here: laravel/ideas#966
Essentially
Resource
is actually a soft-reserved name by PHP and its use is "highly discouraged" as documented here: http://php.net/manual/en/reserved.other-reserved-words.phpSo at the moment there is no issue. Laravel 5.6 will run happily on PHP7.2.
The problem is, at short notice, an RFC might be added to PHP that includes the use of
Resource
, switching it to a full reserved name. If/when that occurs,5.6
will stop working and will not be compatible with that new PHP version, effectively providing an artificial upper ceiling on what PHP version it can run on.Unlike some of the backporting we did to allow older versions of Laravel to run on PHP7.2 with the
count()
issue; this fix would be a "breaking change", so you wouldnt really be able to fix it in any older versions (unless you allow a breaking change on a point release which will send Reddit into meltdown).So I think the best option is just do the change now, place it as part of the 5.6 upgrade guide - especially while it is still a relavitely new feature and not in heavy use, and avoid any future issues.
Otherwise we leave it as is - and risk problems in the future that will be more difficult to resolve (especially if the feature is used more often).
p.s. this doesnt solve the issue for
5.5
which has LTS - so that might be affected by this at a later stage. But I guess we can cross that bridge if we come to it.