- See PHI1981.
- See https://discourse.phabricator-community.org/t/unhandled-exception-error-call-to-a-member-function-setexternaluri-on-null/4538.
In D21511, I renamed the iterator variable in this loop from $path to $submodule_path, but incorrectly did not modify the $path->setExternalURI() call:
foreach ($submodules as $submodule_path) { // <<< Renamed. $full_path = $submodule_path->getFullPath(); $key = 'submodule.'.$full_path.'.url'; if (isset($dict[$key])) { $path->setExternalURI($dict[$key]); // <<< Now incorrect. } }
This scope has a different variable named $path (which the rename was attempting to avoid clobbering), so the static analyzer reasonably couldn't detect this issue.
However, the existence of the original code might point at a bug in the "Variable Reused as Iterator" lint check: I would expect it to have prevented the original code in the first place.