Forum
Categories and Scheduled Tasks
Hi there,
A little while a go I developed a Perch Scheduled Task, that has been working until I updated to Perch 2.8.18. The task loops through XML and creates collection items (and any categories it needs to).
It seems to fail on the catParentID method in PerchCategories_Category.php called from update_meta.
$this->catParentID()
The main part of the script in question is as follows:
//set category set/group id
$categoryDetails = array('catID' => $catID);
//instantiate single category
$category = new PerchCategories_Category($categoryDetails);
//set fields of category
$catDynamicFields = array(
"catDepth" => null,
"desc" =>
array(
"raw" => "",
"processed" => "",
)
);
//more fields of category
$data = array(
'catTitle' => $title,
'catSlug' => $catSlug,
'catDisplayPath' => $title,
'catDynamicFields' => PerchUtil::json_safe_encode($catDynamicFields)
);
//update the category
$category->update($data);
I am also getting an apache error:
[Thu Dec 10 13:24:31 2015] [notice] child pid 16205 exit signal Segmentation fault (11)
When I run method_exists on catParentID, it returns false.
I've been looking at it for best part of today, trying to figure out where it's failing. Perhaps it's just a result of recent core changes. I wondered if you'd be able to shed any light on the matter.
Let me know if you need any additional information.
Thanks.
A seg fault can be hard to debug.
catParentID
isn't a method - it's processed dynamically by a__call()
magic method - so that's not surprising.Do you get any debuggable output at all?
Hi Drew,
I see (
catParentID
)!When I manually run the HTTP request, as I usually do for manual running of the scheduled tasks, it shows me (in chrome):
No data received ERR_EMPTY_RESPONSE
When having perch debug switched on and viewing /perch/core/settings/tasks/
It shows:
I've no idea whether that's helpful or not.
Thanks for the help, I'll let you know if I find anything else.
Cheers,
Quick update, it doesn't seem to be able to run the
to_array
method on line 35 of PerchBase.class.php, for whatever reason. That's as far as I can trace it.Whether it's meant to be running this
else
block , in this context, I'm not sure.Thanks,
Right! I've found Xdebug and it gives some more details:
Hope this helps.
Thanks,
It's running into an infinite loop. I'll get it fixed for 2.8.19.
The
to_array()
method is calling__call()
which is callingto_array()
...2.8.19 is now available.
Thanks Drew,
All fixed!