Top menu disappeared

Contents
Symptom
Root cause
Fix
Regression cover

Symptom

Article and section pages rendered with zero <nav class="address"> blocks. Nothing in the page templates had changed.

Root cause

The shared breadcrumb lookup detects the section class with a get_declared_classes() diff around require_once:

$before = get_declared_classes(); require_once($RelatedArticlesUrl); $new = array_values(array_diff(get_declared_classes(), $before)); if (empty($new)) { return ''; }

Every documented page pre-requires its section file, so the diff is always empty, the lookup always fails, and breadcrumbs silently return an empty string. The cleverness defeated its own documented usage pattern.

Fix

When the diff is empty, find the already-declared class by source file instead of giving up:

$ref = new \ReflectionClass($class); if (realpath($ref->getFileName()) === realpath($url) && $ref->hasMethod('breadcrumbs')) { ... }

Applied in all three page classes. Same behavior for fresh requires, restored behavior for pre-required files.

Regression cover

The content suite accepts --tag address, which asserts <nav class="address"> instead of the bottom marker:

./scripts/run-check.sh --web --url https://testsetup.site --tag address

Article author: Andrei Olegovich

Related articles
Development with PHP
PHP errors: case studies
Top menu disappeared
Live page truncated to 30 bytes
Cannot redeclare get_urls()
Wrong method dialect

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: