Open christophknoth opened 2 years ago
@christophknoth thanks for reporting the issue.
if you can still replicate the issue could you dump the $objectid
on error?
https://github.com/bnomei/kirby3-autoid/blob/76372d3b8d6bab5f4c7188944f48e54f9eb33b51/classes/AutoIDDatabase.php#L244
if (pathinfo($objectid, PATHINFO_EXTENSION)) {
$pathinfo = pathinfo($objectid);
$page = $pathinfo['dirname'];
$filename = $pathinfo['basename'];
} else {
try{
$pathinfo = pathinfo($objectid);
$page = $pathinfo['dirname'] === '.' ? $pathinfo['basename'] : $pathinfo['dirname'] . '/' . $pathinfo['basename'];
$structure = strpos($page, '#') !== false ? explode('#', $page)[1] : '';
} catch(\Exception $ex) {
var_dump($objectid);
echo $ex->getMessage();
die;
}
}
Thank you for getting back to me. I tried what you said and realized that this dump is probably not very helpful:
string(0) ""
--
| Undefined array key "dirname"
So I looked into my code and put an if ($node->linkfield()->toPage()) {
before I use $node->linkfield->fromAutoID()
and that did the trick. It seems with PHP7.4 autoid did not stumble over an empty field.
Hi Bnomei, I am trying out autoid on a server with php8.0.12 and I get the following error
I know you are on parental leave and it is not urgent but I just wanted to let you know. :)