Skip to content

Commit

Permalink
Merge branch '4.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Sep 24, 2020
2 parents cd33da3 + 710ac94 commit e6a28d4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/Resources/contao/dca/tl_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,13 +827,7 @@ public function showFile($row, $href, $label, $title, $icon, $attributes)
*/
public function protectFolder(DataContainer $dc)
{
if (!$dc->activeRecord || !$dc->activeRecord->path)
{
// This should never happen, because DC_Folder does not support "override all"
throw new InvalidArgumentException('The DataContainer object does not contain a valid active record');
}

$strPath = $dc->activeRecord->path;
$strPath = $dc->id;
$projectDir = System::getContainer()->getParameter('kernel.project_dir');

// Only show for folders (see #5660)
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/contao/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ public function getGroupHeader($group, $mode, $field, $row)
*/
public function getActivationDefault($varValue)
{
if (!trim($varValue))
if (trim($varValue) === '')
{
$varValue = (is_array($GLOBALS['TL_LANG']['tl_module']['emailText']) ? $GLOBALS['TL_LANG']['tl_module']['emailText'][1] : $GLOBALS['TL_LANG']['tl_module']['emailText']);
}
Expand All @@ -808,7 +808,7 @@ public function getActivationDefault($varValue)
*/
public function getPasswordDefault($varValue)
{
if (!trim($varValue))
if (trim($varValue) === '')
{
$varValue = (is_array($GLOBALS['TL_LANG']['tl_module']['passwordText']) ? $GLOBALS['TL_LANG']['tl_module']['passwordText'][1] : $GLOBALS['TL_LANG']['tl_module']['passwordText']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/drivers/DC_Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,7 @@ protected function save($varValue)
}

// Set the correct empty value (see #6284, #6373)
if ($varValue === '')
if ((string) $varValue === '')
{
$varValue = Widget::getEmptyValueByFieldType($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['sql']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/drivers/DC_Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3170,7 +3170,7 @@ protected function save($varValue)
}

// Set the correct empty value (see #6284, #6373)
if ($varValue === '')
if ((string) $varValue === '')
{
$varValue = Widget::getEmptyValueByFieldType($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['sql']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/helper/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function deserialize($varValue, $blnForceArray=false)
}

// Empty string
if (!trim($varValue))
if (trim($varValue) === '')
{
return $blnForceArray ? array() : '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/library/Contao/SqlFileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function parse($file)
$subpatterns = array();

// Unset comments and empty lines
if (preg_match('/^[#-]+/', $v) || !trim($v))
if (preg_match('/^[#-]+/', $v) || trim($v) === '')
{
unset($data[$k]);
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/library/Contao/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ public static function deserialize($varValue, $blnForceArray=false)
}

// Empty string
if (!trim($varValue))
if (trim($varValue) === '')
{
return $blnForceArray ? array() : '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/library/Contao/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ protected function validator($varInput)
$varInput = trim($varInput);
}

if (!$varInput)
if ((string) $varInput === '')
{
if (!$this->mandatory)
{
Expand Down

0 comments on commit e6a28d4

Please sign in to comment.