Skip to content

Commit

Permalink
[PHP8.1] Contact data deprecated errors (#38101)
Browse files Browse the repository at this point in the history
* Ensure webpage is set when creating contacts before validating

* Fix parsing empty contact properties
  • Loading branch information
wilsonge committed Jun 20, 2022
1 parent 6ccde6e commit 39dd785
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions administrator/components/com_contact/src/Table/ContactTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ public function store($updateNulls = true)
}

// Store utf8 email as punycode
$this->email_to = PunycodeHelper::emailToPunycode($this->email_to);
if ($this->email_to !== null)
{
$this->email_to = PunycodeHelper::emailToPunycode($this->email_to);
}

// Convert IDN urls to punycode
$this->webpage = PunycodeHelper::urlToPunycode($this->webpage);
if ($this->webpage !== null)
{
$this->webpage = PunycodeHelper::urlToPunycode($this->webpage);
}

// Verify that the alias is unique
$table = Table::getInstance('ContactTable', __NAMESPACE__ . '\\', array('dbo' => $this->getDbo()));
Expand Down Expand Up @@ -151,7 +157,7 @@ public function check()

$this->default_con = (int) $this->default_con;

if (InputFilter::checkAttribute(array('href', $this->webpage)))
if ($this->webpage !== null && InputFilter::checkAttribute(array('href', $this->webpage)))
{
$this->setError(Text::_('COM_CONTACT_WARNING_PROVIDE_VALID_URL'));

Expand Down

0 comments on commit 39dd785

Please sign in to comment.