Live page truncated to 30 bytes

Contents
Symptom
Ruled out
Root cause
Fix

Symptom

A page returned HTTP 200 with a 30-byte body on hosting while the same page rendered fully locally. Error display is off on hosting, so the browser showed a silent truncation instead of the fatal.

Ruled out

  1. Stale files: a probe reporting md5_file() of every involved class proved all 8 hashes identical to the repo.
  2. OPcache: a probe running opcache_invalidate() on 12 files reported success — the page still truncated.

Root cause

src/.php is a symlink to src/ao/.php locally (one inode), but the FTP deploy resolves symlinks into two real directories. One page loaded the same helper through both spellings, and require_once — which dedupes by path, not by inode across machines — loaded it twice:

Fatal error: Cannot redeclare get_urls()

Unreproducible locally by design: the two paths can never diverge while linked.

Fix

Guard the definition so the second load is a no-op:

if (!function_exists('get_urls')) { function get_urls(...$numbers) { ... } } // function_exists('get_urls')

The hosting error log named file and line outright — it is always the first place to look. A repo-wide scan found 9 files requiring their own twin path; 8 were commented out, only this one executed.

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
Banner image

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: