php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76230 use function getenv('REMOTE_ADDR'), i get Internal Server Error
Submitted: 2018-04-17 16:10 UTC Modified: 2018-04-18 08:04 UTC
From: 875019860 at qq dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 7.2.1 OS: win10
Private report: No CVE-ID: None
 [2018-04-17 16:10 UTC] 875019860 at qq dot com
Description:
------------
---
From manual page: http://www.php.net/function.getenv
---

$test = getenv('REMOTE_ADDR');
var_dump($test);


Test script:
---------------
<?php
$test = getenv('REMOTE_ADDR');
var_dump($test);
// i run this, get 500

Expected result:
----------------
Internal Server Error


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-17 16:19 UTC] spam2 at rhsoft dot net
"i get 500 but expected result Internal Server Error" makes no sense because it#s the same and i fail to see why do you expect that

a internal server error is typically the response when a fatl error occurs
http://php.net/manual/en/function.error-reporting.php

either you have a syntax error somewhere and your test-script is not the whole code you run in reality or you have to look in errorlogs of webserver - maybe php don't work at all

however that bugreport is completly wrong 

BTW: getenv('REMOTE_ADDR'); 
why? 

ther is $_SERVER['REMOTE_ADDR'] which is way cheaper than a function call and it's not sure at all that you can get this on every system a env-var
 [2018-04-17 16:20 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-04-17 16:20 UTC] requinix@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


What does the error log say is the reason for the 500?
 [2018-04-18 08:04 UTC] 875019860 at qq dot com
-Status: Feedback +Status: Closed -PHP Version: 7.2.4 +PHP Version: 7.2.1
 [2018-04-18 08:04 UTC] 875019860 at qq dot com
see bug #75794
https://bugs.php.net/bug.php?id=75794
 [2018-04-18 08:42 UTC] spam2 at rhsoft dot net
i see https://bugs.php.net/bug.php?id=75794 and it clearly states "2018-01-15 Closing as the issue is confirmed fixed" while you report on 2018-04-17 for 7.2.1 and do not mention even that the server is crashing

would be so kind and in the future first update to the last bugfix release like 7.2.4 is now current and see if the problem is already fixed?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC