Skip to content

fix(antd-php): use cost-estimate fields in example 02 to avoid stringification fatal#74

Merged
Nic-dorman merged 1 commit into
mainfrom
fix/php-example-cost-stringification
May 14, 2026
Merged

fix(antd-php): use cost-estimate fields in example 02 to avoid stringification fatal#74
Nic-dorman merged 1 commit into
mainfrom
fix/php-example-cost-stringification

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Fixes #66.

The example interpolated the whole UploadCostEstimate object into a string, which lacks __toString() and so fatals on PHP 8.3:

PHP Fatal error: Uncaught Error: Object of class Autonomi\Antd\Models\UploadCostEstimate could not be converted to string in 02-data.php:17

Print individual cost-estimate fields instead, matching what the Python / Rust / Kotlin examples already do. Also adds a round-trip assertion and an OK marker so the example self-verifies (useful for any cross-language e2e harness).

Test plan

  • php examples/02-data.php against a local devnet — exits 0, prints estimate fields, stored address, and "Public data round-trip OK!"
  • Verified via the cross-SDK e2e harness used to find this bug

Sample output

Estimate: 16 bytes in 3 chunks, storage 43945312500000000 atto, gas 150000000000000 wei, mode single
Stored at address: 01b06330e4f4a8c565087e4087caabf860bdadbe96b7b8f0447493b0081c2335
Actual cost:  atto tokens
Retrieved: Hello, Autonomi!
Public data round-trip OK!

(The Actual cost: line being blank is unrelated — PutResult.cost arrives as an empty string from the daemon; not addressed in this PR.)

…ification fatal

The example interpolated the whole UploadCostEstimate object into a
string, which lacks __toString() and so fatals on PHP 8.3:

  PHP Fatal error: Object of class Autonomi\Antd\Models\UploadCostEstimate
  could not be converted to string in 02-data.php:17

Print individual fields instead, matching the Python/Rust/Kotlin examples.
Also adds a round-trip assertion and an OK marker so the example self-verifies.

Closes #66
@Nic-dorman
Nic-dorman merged commit b9092f5 into main May 14, 2026
@Nic-dorman
Nic-dorman deleted the fix/php-example-cost-stringification branch May 14, 2026 11:03
Nic-dorman added a commit that referenced this pull request May 14, 2026
Cuts v0.7.1 atop v0.7.0. Primarily refreshes the upstream `ant-core`
pin to the `ant-cli-v0.2.3` release tag (no API change for antd
consumers). Bundles a substantial round of cross-SDK example/build
fixes, dispatcher improvements, and CI/release workflow hardening.

## antd

- chore(antd): bump ant-core to v0.2.3 (#85)

## SDK example/build fixes

- fix(antd-php): use cost-estimate fields in example 02 (#74)
- fix(antd-elixir): print cost-estimate fields in examples (#75)
- fix(antd-lua): add missing discover module to rockspec (#76)
- fix(antd-kotlin): make put-response cost optional + ship gradle wrapper (#77)
- fix(antd-zig): pass payment_mode to dataPutPublic/dataPutPrivate (#79)
- fix(antd-java): make examples runnable via gradle :examples subproject (#80)
- fix(antd-zig): align stdlib API to declared 0.14.x minimum (#82)
- fix(antd-swift): port to Linux + populate cost-estimate fields (#87)

## ant-dev (developer CLI)

- fix(ant-dev): clean up orphan anvil/antnode and stale node identities on stop (#81)
- fix(ant-dev): tooling cluster — flag alias, sys.executable, anvil preflight, README (#83)
- feat(ant-dev): expand `ant dev example` to dispatch all 15 SDKs (#84)
- fix(ant-dev): dispatcher swift no-skip + lua LUA_PATH wrap (#86)
- feat(ant-dev): expose --preset flag on `ant dev start` (default: small) (#88)

## CI / release

- ci: authenticate arduino/setup-protoc on ci.yml too (#60)
- feat(release): publish antd-linux-arm64 artifact (#89)

## Validation

15/15 SDKs round-tripped end-to-end against a daemon built from this
commit on a Linux dev box (Ubuntu 24.04, 0.7.1 atop ant-core v0.2.3).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

antd-php example 02-data.php fatals: UploadCostEstimate not stringable

1 participant