eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
188 stars 46 forks source link

$http_response_header is wrongly marked as undefined #267

Open flack opened 6 months ago

flack commented 6 months ago

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

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