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(); $user->getrights();
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if (! isset($argv[1])) { // Check parameters if (! isset($argv[1])) { // Check parameters
print "Usage: ".$script_file." param1 param2 ...\n"; print "Usage: ".$script_file." param1 param2 ...\n";
exit(-1); exit(-1);

View File

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

View File

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

View File

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