PHP 8.x turned several long-standing implicit accesses into runtime
warnings that flooded the error log during attacks and report viewing:
- Battle.report (Templates/Notice/1.tpl): the prisoner check ran
array_sum() over slots that may hold non-numeric text (the
"Information" line can shift indices), raising
"Addition is not supported on type string". Sum int-cast values.
- Database::getUnitsNumber(): movement/reinforcement arrays can be null
or miss tribe-specific unit keys, raising "Undefined array key" and
"Trying to access array offset on null". Null-coalesce to 0.
- Automation (combat resolver): $scout was only defined for scouting
attacks (type 1) yet always passed to buildCombatReport(), raising
"Undefined variable $scout". Initialize it for every attack type.
- Automation: the destroy-village check read $to['natar'] which is not
always set, raising "Undefined array key". Use empty().
Pure null-safety / behaviour-preserving changes; no gameplay logic
altered.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Honour the per-user auto-completion checkboxes on the rally point and the
marketplace, where the target village is typed by name (dname field):
- v1: own villages
- v2: villages in the surroundings of the active village
- v3: villages of the player's alliance members
A new Database::getAutoCompleteVillages() builds the bounded, de-duplicated
name list from the enabled categories (system accounts excluded). A shared
Templates/villageAutocomplete.tpl renders a native <datalist> consumed by
the dname input via list="dnameSuggest"; nothing is emitted when every box
is unchecked, keeping the previous behaviour. Removes the "not coded yet"
tag from the auto-completion section in the preferences form.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Addresses the five bugs found on master (6e139a1b) during a fresh
Docker install and admin testing:
1. Missing `details` column in gold_fin_log (HTTP 500 on finishing
construction with gold, buying Gold Club, admin giving gold):
- Add `details varchar(255)` to the gold_fin_log schema, matching
every INSERT and the a2b2.php reader that already use it.
- Fix the broken positional INSERT in Logging::goldFinLog() (it sent
3 values for a 7-column table) which 500'd on the same gold path.
2. Admin "View Player Info" fatal error: `<? php` -> `<?php` in
Admin/Templates/playerinfo.tpl.
3. "Reset Server" leaving the DB corrupted (Duplicate key name
'idx_ft_bonus_xy'): move the croppers indexes inline into the
CREATE TABLE IF NOT EXISTS so structure recreation is idempotent,
and add `croppers` to the reset truncate list.
4. Install wizard crash on failed DB connection (mysqli_error(false)):
use mysqli_connect_error() and show a friendly, actionable message
(incl. the Docker "db" hostname hint).
5. PHP exposing errors/stack traces to end users: ship a production
php.ini baseline + docker/php/zz-travianz.ini that turns off
display_errors and logs to stderr instead.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore.
2. Now Alliance Leader can edit his own Position
3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1
4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder)
5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
Incremental Refactor Automation (starvation split in more methods) & Database (cache & checkAllianceEmbassiesStatus refactor), Fix a bug in Alliance.php (now you cannot kick alliance leader)