dom - PHP DOMNodeList Error: Works in dev but not in production -
i have below piece of code working fine on local development server should not on production. local development environment using php 5.6.12
, production server using php 5.4.36
, i'm getting below error in production logs, no errors in local development logs.
php fatal error: cannot use object of type domnodelist array in /public_html/dev_host/jobs.php on line 111
line 110 - 113:
$productraw = $data->getelementsbytagname('a'); $productid = $this->parseproductid($productraw[0]->attributes[0]->nodevalue); $productattributes = (array) json_decode($productraw[0]->attributes[2]->nodevalue); $productdetails = $this->parseproductdetails($productattributes['name']);
the ability treat domnodelist
array added in php 5.6.3.
earlier php 5.6.3, have use $productraw->item(0);
instead of $productraw[0]
.
this bug #67949 , listed in 5.6.3 changelog, otherwise appears undocumented.
Comments
Post a Comment