pdt icon indicating copy to clipboard operation
pdt copied to clipboard

$http_response_header is wrongly marked as undefined

Open flack opened this issue 4 months ago • 0 comments

Describe the bug If you take the example code from https://www.php.net/manual/en/reserved.variables.httpresponseheader.php:


<?php
function get_contents() {
  file_get_contents("http://example.com");
  var_dump($http_response_header); // variable is populated in the local scope
}
get_contents();
var_dump($http_response_header); // a call to get_contents() does not populate the variable outside the function scope
?>

PDT renders it like this:

Bildschirmfoto 2024-01-19 um 12 47 34

So the warnings are exactly the wrong way around.

Describe the eclipse environment Eclipse 2023-12 Eclipse PDT 8.3.0.202312151406

Describe your system

  • OS: macOS
  • Version 13.6

To Reproduce see above

Expected behavior It's probably hard to determine statically when exactly the variable is defined, so it might be better to be consistent and either mark all occurences as defined or all occurences as undefined.

Screenshots see above

flack avatar Jan 19 '24 11:01 flack