Open djaevlen opened 5 years ago
Thanks for submitting, can you tell me what versions of ACF Builder and PHP you're using?
Yes sure, they are:
ACF Builder 1.8.0
WordPress 5.0.3
PHP 7.2
We are running with an Bedrock installation setup.
Note that we are using "Local by Flywheel" to run our local dev env.
Looking through the code, https://github.com/StoutLogic/acf-builder/blob/master/src/FieldManager.php#L131-L140 calls getFieldIndex
to determine if it the field name exists or not and then catches the exception if it doesn't. Since it gets caught, I don't know enough about XDebug to know why it is still complaining.
And while is is probably not the best idea to control logic with exceptions, that is what it is doing currently, fieldNameExists
is piggy-backing on the very getFieldIndex
which does have legit reasons for throwing the exception.
Our options seem to be figure out why XDebug is doing this, or rewriting fieldNameExists to not rely on catching exceptions.
Thank goodness I found this, thought I was the only one and was going mad.
Looking at old threads (https://tinyurl.com/y6m23odj) seems like it's an issue with Xdebug. I tried setting xdebug.show_exception_trace=0
and the problem still persists - wondering if you found a workaround, @djaevlen ?
Using VS Code, found a way for the exception not to explode in my face, so am back to happy debugging:
https://lh5.googleusercontent.com/L-2TjAY1OcAFxpWZS-8svW2lp-t9gktbbgVt1gu2dwMwUBLi3ebKcITtSHw
Basically bring up the breakpoints window and de-selecting the everything option.
Source: https://tinyurl.com/y6qzyk7b
Hi there,
We are having a basic theme options setup like this:
Which outputs this:
If we turn on Xdebug, we get an Exception thrown called
FieldNotFoundException
. See stack trace here:Everything works fine with Xdebug turned off. We can access the field data and everything, but Xdebug will throw an Exception, if we enable it.
And it's not only on our options ACF. It's on all our ACF fields we try to register.
What could cause this? From what we can see, is that when
getFieldIndex($field)
tries to find the index, the$this->getFields
array is somehow empty, resulting in Exception to be thrown.https://github.com/StoutLogic/acf-builder/blob/master/src/FieldManager.php#L198