Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot redeclare getmypid() #1792

Merged
merged 1 commit into from Jul 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/skeletons/skeleton_script.php
Expand Up @@ -57,7 +57,7 @@
$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);
Expand Down
26 changes: 14 additions & 12 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -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))
Expand Down Expand Up @@ -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();
}
}


Expand Down
2 changes: 1 addition & 1 deletion htdocs/includes/phpexcel/PHPExcel/Shared/PDF/tcpdf.php
Expand Up @@ -11427,7 +11427,7 @@ protected function getRandomSeed($seed='') {
}
$seed .= uniqid('', true);
$seed .= rand();
$seed .= getmypid();
$seed .= dol_getmypid();
$seed .= __FILE__;
$seed .= $this->bufferlen;
if (isset($_SERVER['REMOTE_ADDR'])) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/includes/tcpdf/include/tcpdf_static.php
Expand Up @@ -1358,7 +1358,7 @@ public static function getRandomSeed($seed='') {
}
$seed .= uniqid('', true);
$seed .= rand();
$seed .= getmypid();
$seed .= dol_getmypid();
$seed .= __FILE__;
if (isset($_SERVER['REMOTE_ADDR'])) {
$seed .= $_SERVER['REMOTE_ADDR'];
Expand Down