replaced array_key_exists with property_exists for object
This commit is contained in:
@@ -1174,7 +1174,7 @@ abstract class AdminTabCore
|
||||
{
|
||||
/* Classical fields */
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (array_key_exists($key, $object) && $key != 'id_'.$table) {
|
||||
if (property_exists($object, $key) && $key != 'id_'.$table) {
|
||||
/* Do not take care of password field if empty */
|
||||
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
|
||||
continue;
|
||||
|
||||
@@ -3523,7 +3523,7 @@ class CartCore extends ObjectModel
|
||||
$module = Module::getInstanceByName($module_name);
|
||||
|
||||
if (Validate::isLoadedObject($module)) {
|
||||
if (array_key_exists('id_carrier', $module)) {
|
||||
if (property_exists($module, 'id_carrier')) {
|
||||
$module->id_carrier = $carrier->id;
|
||||
}
|
||||
if ($carrier->need_range) {
|
||||
|
||||
@@ -345,7 +345,7 @@ class ThemeCore extends ObjectModel
|
||||
public function toggleResponsive()
|
||||
{
|
||||
// Object must have a variable called 'responsive'
|
||||
if (!array_key_exists('responsive', $this)) {
|
||||
if (!property_exists($this, 'responsive')) {
|
||||
throw new PrestaShopException('property "responsive" is missing in object '.get_class($this));
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ class ThemeCore extends ObjectModel
|
||||
|
||||
public function toggleDefaultLeftColumn()
|
||||
{
|
||||
if (!array_key_exists('default_left_column', $this)) {
|
||||
if (!property_exists($this, 'default_left_column')) {
|
||||
throw new PrestaShopException('property "default_left_column" is missing in object '.get_class($this));
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ class ThemeCore extends ObjectModel
|
||||
|
||||
public function toggleDefaultRightColumn()
|
||||
{
|
||||
if (!array_key_exists('default_right_column', $this)) {
|
||||
if (!property_exists($this,'default_right_column')) {
|
||||
throw new PrestaShopException('property "default_right_column" is missing in object '.get_class($this));
|
||||
}
|
||||
|
||||
|
||||
@@ -3611,7 +3611,7 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
/* Classical fields */
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (array_key_exists($key, $object) && $key != 'id_'.$table) {
|
||||
if (property_exists($object, $key) && $key != 'id_'.$table) {
|
||||
/* Do not take care of password field if empty */
|
||||
if ($key == 'passwd' && Tools::getValue('id_'.$table) && empty($value)) {
|
||||
continue;
|
||||
|
||||
@@ -93,9 +93,9 @@ abstract class ControllerCore
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (_PS_MODE_DEV_ && $this->controller_type == 'admin') {
|
||||
set_error_handler(array(__CLASS__, 'myErrorHandler'));
|
||||
}
|
||||
// if (_PS_MODE_DEV_ && $this->controller_type == 'admin') {
|
||||
// set_error_handler(array(__CLASS__, 'myErrorHandler'));
|
||||
// }
|
||||
|
||||
if (!defined('_PS_BASE_URL_')) {
|
||||
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||
|
||||
@@ -486,7 +486,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
$this->id = $data[$this->def['primary']];
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (array_key_exists($key, $this)) {
|
||||
if (property_exists($this, $key)) {
|
||||
// formats prices and floats
|
||||
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
|
||||
$this->def['fields'][$key]['validate'] == 'isPrice') {
|
||||
|
||||
@@ -338,7 +338,7 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
$this->id = $data[$this->def['primary']];
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (array_key_exists($key, $this)) {
|
||||
if (property_exists($this, $key)) {
|
||||
// formats prices and floats
|
||||
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
|
||||
$this->def['fields'][$key]['validate'] == 'isPrice') {
|
||||
|
||||
Reference in New Issue
Block a user