Skip to content

Commit 8ab3a5c

Browse files
committed
feat: add nullable elements if string is equal null
1 parent 146f13e commit 8ab3a5c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

includes/classes/API.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,9 @@ private function delete($query, $db = null)
11291129
// bind WHERE values
11301130
if (!empty($where_values) && count($where_values) > 0) {
11311131
foreach ($where_values as $key => $value) {
1132+
if (is_string($value) && strtolower($value) === 'null') {
1133+
$value = null;
1134+
}
11321135
$type = self::detectPDOType($value);
11331136
$key = ':' . $key;
11341137
$sql_compiled = self::debugCompileSQL($sql_compiled, $key, $value);
@@ -1168,7 +1171,7 @@ private function executeInsert($table, $columns, $dbh)
11681171
if (is_array($value)) {
11691172
$value = serialize($value);
11701173
}
1171-
if (is_string($value) && strtolower($value) == 'null') {
1174+
if (is_string($value) && strtolower($value) === 'null') {
11721175
$value = null;
11731176
}
11741177
$column = ':' . $column;
@@ -1846,7 +1849,7 @@ private function getCache($key)
18461849
$tmpdir = sys_get_temp_dir();
18471850
if (!empty($this->cache[$key])) {
18481851
return $this->cache[$key];
1849-
} elseif ((ini_get('opcache.enable') == 0 || ini_get('apc.enabled') == 0) && is_writable($tmpdir)) {
1852+
/*} elseif ((ini_get('opcache.enable') == 0 || ini_get('apc.enabled') == 0) && is_writable($tmpdir)) {
18501853
$file = $tmpdir . DIRECTORY_SEPARATOR . $key;
18511854
$ttl = (!empty($this->db->ttl)) ? $this->db->ttl : $this->ttl;
18521855
if (file_exists($file)) {
@@ -1858,6 +1861,7 @@ private function getCache($key)
18581861
}
18591862
18601863
return isset($value) ? $value : false;
1864+
*/
18611865
} elseif (extension_loaded('apc') || (ini_get('apc.enabled') == 1)) {
18621866
return apc_fetch($key);
18631867
}
@@ -1879,15 +1883,16 @@ private function setCache($key, $value, $ttl = null)
18791883
$this->cache[$key] = $value;
18801884

18811885
$tmpdir = sys_get_temp_dir();
1882-
if ((ini_get('opcache.enable') == 0 || ini_get('apc.enabled') == 0) && is_writable($tmpdir)) {
1886+
/*if ((ini_get('opcache.enable') == 0 || ini_get('apc.enabled') == 0) && is_writable($tmpdir)) {
18831887
$value = var_export($value, true);
18841888
// HHVM fails at __set_state, so just use object cast for now
18851889
$value = str_replace('stdClass::__set_state', '(object)', $value);
18861890
// Write to temp file first to ensure atomicity
18871891
$tmp = $tmpdir . DIRECTORY_SEPARATOR . $key . '.' . uniqid('', true) . '.tmp';
18881892
file_put_contents($tmp, '<?php $val = ' . $value . ';', LOCK_EX);
18891893
rename($tmp, $tmpdir . DIRECTORY_SEPARATOR . $key);
1890-
} elseif ($ttl == null) {
1894+
} else*/
1895+
if ($ttl == null) {
18911896
$ttl = (!empty($this->db->ttl)) ? $this->db->ttl : $this->ttl;
18921897
}
18931898

0 commit comments

Comments
 (0)