Merge pull request #1792 from frederic34/getmypid

Cannot redeclare getmypid()
This commit is contained in:
Laurent Destailleur 2014-07-31 14:38:00 +02:00
commit 1e7b100770
4 changed files with 17 additions and 15 deletions

View File

@ -57,7 +57,7 @@ if (! $result > 0) { dol_print_error('',$user->error); exit; }
$user->getrights();
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if (! isset($argv[1])) { // Check parameters
print "Usage: ".$script_file." param1 param2 ...\n";
exit(-1);

View File

@ -2333,7 +2333,7 @@ function dol_print_error($db='',$error='')
else // Mode CLI
{
$out.='> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n";
$syslog.="pid=".getmypid();
$syslog.="pid=".dol_getmypid();
}
if (is_object($db))
@ -4742,18 +4742,20 @@ function dol_set_focus($selector)
}
if (! function_exists('getmypid'))
/**
* Return getmypid() or random PID when function is disabled
* Some web hosts disable this php function for security reasons
* and sometimes we can't redeclare function
*
* @return int
*/
function dol_getmypid()
{
/**
* Return random PID
* Some web hosts disable this php function for security reasons
*
* @return int
*/
function getmypid()
{
return rand(1,32768);
}
if (! function_exists('getmypid')) {
return rand(1,32768);
} else {
return getmypid();
}
}

View File

@ -11427,7 +11427,7 @@ class TCPDF {
}
$seed .= uniqid('', true);
$seed .= rand();
$seed .= getmypid();
$seed .= dol_getmypid();
$seed .= __FILE__;
$seed .= $this->bufferlen;
if (isset($_SERVER['REMOTE_ADDR'])) {

View File

@ -1358,7 +1358,7 @@ class TCPDF_STATIC {
}
$seed .= uniqid('', true);
$seed .= rand();
$seed .= getmypid();
$seed .= dol_getmypid();
$seed .= __FILE__;
if (isset($_SERVER['REMOTE_ADDR'])) {
$seed .= $_SERVER['REMOTE_ADDR'];