Skip to content

Audit fixes: ext info parse-error bug + doctor did-you-mean#26

Merged
devhardiyanto merged 3 commits into
mainfrom
audit-fixes-ext-info-doctor
Jul 24, 2026
Merged

Audit fixes: ext info parse-error bug + doctor did-you-mean#26
devhardiyanto merged 3 commits into
mainfrom
audit-fixes-ext-info-doctor

Conversation

@devhardiyanto

@devhardiyanto devhardiyanto commented Jul 24, 2026

Copy link
Copy Markdown
Owner

What

Full-codebase audit atas source-code/phpvm (Gap · Redundan · Deprecated/removed · Quality/commented-code). Menemukan & memperbaiki 1 bug nyata + 1 gap + 1 komentar rusak. Tak ada refactor besar.

Why

Diminta audit menyeluruh pasca v1.12.2. Temuan yang bisa di-resolve aman diperbaiki; yang berisiko/by-design didokumentasikan tanpa diubah (anti-melebar).

How

  • Q1 (bug, Windows): Ext-Info meng-emit PHP if ($version -eq $null)-eq/$null operator PowerShell, bukan PHP → parse error yang ditelan 2>$null, jadi phpvm ext info <name> di Windows selalu kosong. Diperbaiki dengan menyamakan snippet ke versi Linux yang benar: (getVersion() ?? 'n/a'). Diverifikasi jalan di PHP 8.3.
  • G1 (gap, kedua OS): command doctor (rilis 1.12.0) belum terdaftar di did-you-mean, jadi typo doctro tak menyaran doctor. Ditambah 1:1 di kedua OS + regression test.
  • Q2 (Windows): komentar header Invoke-Doctor ke-split akibat sisipan Test-ExtDirMatch (patch 1.12.1) → dirapikan. Comment-only.

Changes

  • windows/phpvm.ps1 — ext-info snippet valid PHP; doctor di did-you-mean; komentar doctor dirapikan
  • linux/phpvm.shdoctor di _PHPVM_COMMANDS (paritas)
  • tests/windows/PureFunctions.Tests.ps1 + tests/linux/commands.bats — cover suggestion doctor

Tidak diubah (sengaja)

  • Blok download curl/wget berulang di .sh → refactor B8-style, di luar scope.
  • Linux ext loaded == ext list → by-design (build-from-source tak ada DLL ON/OFF).
  • Tak ada dead code / deprecated tersisa.

Testing Done

  • Pester (Windows) 82/82 pass (+1 test doctor)
  • PSScriptAnalyzer (repo settings) clean
  • bash -n linux/phpvm.sh OK; snippet ext-info hasil-fix diverifikasi di PHP 8.3
  • bats + shellcheck — dijalankan CI (tak tersedia lokal)

…idy comment

- ext info: the -r snippet used PowerShell operators ($version -eq $null)
  inside PHP code, a parse error that 2>$null swallowed, so 'phpvm ext info'
  printed nothing. Mirror the Linux snippet: (getVersion() ?? 'n/a').
- did-you-mean: register 'doctor' (shipped 1.12.0) so a 'doctro' typo suggests it.
- tidy the Invoke-Doctor header comment that got split by the 1.12.1
  Test-ExtDirMatch insertion. Comment-only.

devhardiyanto
'doctor' (shipped 1.12.0) was missing from _PHPVM_COMMANDS, so a typo like
'doctro' never suggested it. Parity with the Windows fix.

devhardiyanto
@devhardiyanto
devhardiyanto merged commit 12e0667 into main Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant