Skip to content

Commit

Permalink
Remove safe mode references
Browse files Browse the repository at this point in the history
safe_mode was deprecated in PHP 5.3 and removed in 5.4. This removes
remaining references to it in the code.

Fixes #934
  • Loading branch information
dregad committed Mar 17, 2023
1 parent c37230e commit 96236f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions adodb.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,7 @@ function flushcache($f, $debug=false) {
*/
function getdirname($hash) {
global $ADODB_CACHE_DIR;
if (!isset($this->notSafeMode)) {
$this->notSafeMode = !ini_get('safe_mode');
}
return ($this->notSafeMode) ? $ADODB_CACHE_DIR.'/'.substr($hash,0,2) : $ADODB_CACHE_DIR;
return $ADODB_CACHE_DIR . '/' . substr($hash, 0, 2);
}

/**
Expand All @@ -409,7 +406,7 @@ function createdir($hash, $debug) {
global $ADODB_CACHE_PERMS;

$dir = $this->getdirname($hash);
if ($this->notSafeMode && !file_exists($dir)) {
if (!file_exists($dir)) {
$oldu = umask(0);
if (!@mkdir($dir, empty($ADODB_CACHE_PERMS) ? 0771 : $ADODB_CACHE_PERMS)) {
if(!is_dir($dir) && $debug) {
Expand Down Expand Up @@ -2472,7 +2469,7 @@ function CacheFlush($sql=false,$inputarr=false) {
* - userid
* - setFetchMode (adodb 4.23)
*
* When not in safe mode, we create 256 sub-directories in the cache directory ($ADODB_CACHE_DIR).
* We create 256 sub-directories in the cache directory ($ADODB_CACHE_DIR).
* Assuming that we can have 50,000 files per directory with good performance,
* then we can scale to 12.8 million unique cached recordsets. Wow!
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@ function adodb_test_err($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)

CheckWS('firebird');
CheckWS('sybase');
if (!ini_get('safe_mode')) CheckWS('informix');
CheckWS('informix');

CheckWS('ado_mssql');
CheckWS('ado_access');
Expand Down

0 comments on commit 96236f4

Please sign in to comment.