user

Eslam Zedan

23 Feb 2022

Warning appears in Zend framework

PHP & Mysql

Hello,

I am Working on Zend 2 and there are warning that appears in Zend framework itself:

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/vendor/zendframework/library/Zend/Stdlib/ArrayObject.php on line 426

And here is the code that returns the problem:

public function unserialize($data)
 {
 $ar = unserialize($data);
 $this->protectedProperties = array_keys(get_object_vars($this));

 $this->setFlags($ar['flag']);
 $this->exchangeArray($ar['storage']);
 $this->setIteratorClass($ar['iteratorClass']);

 foreach ($ar as $k => $v) {
 switch ($k) {
 case 'flag':
 $this->setFlags($v);
 break;
 case 'storage':
 $this->exchangeArray($v);
 break;
 case 'iteratorClass':
 $this->setIteratorClass($v);
 break;
 case 'protectedProperties':
 continue; #This is the line 426
 default:
 $this->__set($k, $v);
 }
 }
 }

Comments

walid mahmoud

24 Feb 2022

Best Answer

best answer

you can replace 
continue with continue 2 
the warning will disappear

© 2024 Copyrights reserved for web-brackets.com