Distinguish Successful Empty PHP Output from a Failed PHP Token

A QCDR PHP Token can legitimately succeed and output an empty string. That is different from a PHP execution failure. QCDR 1.1.05 keeps those states separate so hidden failures preserve authored content while intentional no-output PHP is allowed to resolve to blank.

This distinction is important when a placeholder disappears: a blank result may be exactly what the PHP produced, not evidence that QCDR failed.

Successful Empty Output

If valid PHP executes without an error/warning and emits nothing, QCDR records a successful result whose output is an empty string. In Once per page request mode, that successful empty value is cached and reused for later occurrences in the same request.

A standalone Token placeholder can therefore disappear completely. A Rule using that Token as a Replace value can replace its selected match with an empty value. This is intentional successful output, not the hidden-failure sentinel.

Hidden Failure

When PHP throws an error or produces an unsuppressed warning while Hide PHP errors is selected, QCDR marks the Token unresolved. It does not convert the failure into an ordinary empty string.

  • A standalone authored placeholder remains unchanged.
  • A Rule using the PHP Token leaves its original matched text unchanged.
  • A dependent Token/direct replacement can remain wholly unapplied rather than producing partial output around a failed PHP dependency.

Show Mode Makes Many Failures Visible

Temporarily selecting Show sanitized PHP errors can turn a thrown error or captured warning into a visible sanitized QCDR diagnostic. That is a useful way to distinguish a hidden PHP problem from code that intentionally emits nothing.

Not every operational failure has a frontend Show marker. Temporary-file failures and oversized PHP output can still fail closed, so QCDR/Joomla logs remain important.

A Controlled Diagnostic Test

  1. Limit the PHP Token to a controlled test page.
  2. Temporarily change its PHP error mode to Show.
  3. Add a harmless, unmistakable output marker such as echo 'QCDR-PHP-OK'; to the code path you expect to run.
  4. Load the page. If the marker appears, the Token executed successfully.
  5. Remove the marker and determine whether the production code is intentionally designed to emit nothing.
  6. Restore Hide mode after troubleshooting.

Check Every Occurrence Separately When Needed

In Every occurrence mode, one occurrence can run the code independently from another. In Once per page request mode, the first success/failure result is reused for that PHP Token during the request. Keep the selected execution mode in mind when reproducing a blank or failure.

Empty Code Is Not a Valid Saved Token

QCDR's editor rejects an empty PHP code body at save time. The “successful empty” case therefore means non-empty valid PHP executed and simply emitted no output—not that an empty PHP Token configuration was accepted.

Practical Rule

Placeholder/match preserved with Hide: investigate an unresolved failure or unavailable Token. Placeholder replaced by nothing: investigate whether the PHP successfully produced an empty result. Use sanitized Show mode and logs to prove which path occurred instead of guessing.


Community Discussion

Want to compare workflows, share practical tips, or discuss how you use this QCDR feature? Visit the QC Dynamic Replacer Community. For private support, bug reports, account-specific issues, or feature requests, use the QuantaCade support system.