|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-01-12 13:10 UTC] spam2 at rhsoft dot net
Description:
------------
PHP Warning: popen() has been disabled for security reasons
sorry, but that is nonsense because from the view of the script it make sno difference if a function can't be called becaus ea typo or because it is disabled and so completly legit code for optional features don't work
BUT you can't try-catch warnings
private function syslog(string $message)
{
global $cms_syslog;
/** Je nach Serverkonfiguration nicht vorhanden */
try
{
/** Usernamen hinzufuegen wenn angemeldet */
if(!empty($_SESSION[CMS_HOST_HASH . '_auth_uname']))
{
$message .= " ({$_SESSION[CMS_HOST_HASH . '_auth_uname']})";
}
/** Sonderzeichen filtern */
$message = strip_tags($this->escape_logitem($message));
/** Kommando mittels "popen" ausfuehren und Rueckgabe in Variable schreiben */
if($fp = popen($cms_syslog . ' ' . escapeshellarg($message) , 'r'))
{
pclose($fp);
return true;
}
else
{
return false;
}
}
catch(Error $e)
{
return false;
}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
> BUT you can't try-catch warnings That's not necessarily correct surely, just try it out, this has changed in PHP7, the code below works perfectly when you don't load pecl-apcu and is much cheaper than function_exists() in case normally the extension is expected to be there and have it not loaded is really the exception i can't see the BC break at all - when someone is calling a function he expects it to be called and on most production servers warnings are nt displayed so he even has no chance to realize why something acts unexpected, with a exception/error it's clear frnakly the whole disable_functions() stuff should be reworked so that it also works PER_DIR and not only global (suhosin in the past had a similar feature and i didn't see the pretended performance impact) try { $cache_entry = apcu_fetch($template_key); if($cache_entry !== false) { return $cache_entry; } } catch(Error $e){}