Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Feature Request: Implement `__debugInfo()` on `Aws\Command` to prevent massive `var_dump` / log output

Aperta Adatta ai principianti
#3,365 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@stobrien89 ci sta già lavorando.

Dal 25/10/2026.

  • #3390 di @stobrien89 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Partire da Aws\Command e riprodurre lo scenario di example.php che esegue il dump di una AwsException contenente un command. Implementare la rappresentazione di debug ridotta richiesta per il command, preservando il nome e i dati essenziali ed evitando l'output ricorsivo di handler e modello API. Il lavoro è completato quando var_dump($e) non produce più il massiccio output annidato descritto nell'issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature-request needs-triage
Describe the feature

I would like to request implementing the magic method __debugInfo() on Aws\Command (and potentially related internal objects. e.g. Aws\HandlerList) to suppress excessively large outputs when using var_dump(), print_r().

When an exception occurs (e.g. Aws\Exception\AwsException), dumping the exception via var_dump($e) or passing it to certain loggers results in extremely large output.
This is mainly because AwsException holds an instance of Aws\Command, which references heavy nested service handlers and shape definitions.

Use Case
# example.php
require_once __DIR__ . '/vendor/autoload.php';

$s3Client = new Aws\S3\S3Client([/* ... */]);

try {
    $s3Client->getObject([
        'Bucket' => 'test-bucket',
        'Key'    => 'notfound.txt',
    ]);
} catch (Exception $e) {
    var_dump($e);
}

Running the above script produces gigabytes of text output because var_dump recursively traverses all properties inside Command and its associated API models/handlers.
This makes print-debugging almost impossible and can easily overwhelm logging storage/buffers in production or development environments.

$ php example.php > out.txt
$ ls -l | grep out.txt
-rwxr-xr-x 1 user group 26626988124 Oct  2 13:52 out.txt
Proposed Solution

Implement __debugInfo() in Aws\Command so that only essential debug details (such as command name and passed arguments) are returned during inspection.

By defining __debugInfo(), PHP will use this reduced array for var_dump() / print_r() instead of recursively dumping all internal property references.

for example:

namespace Aws;

class Command implements CommandInterface
{
    // ...

    public function __debugInfo(): array
    {
        return [
            'name' => $this->name,
            'data' => $this->data,
        ];
    }
}

Then, Output is below:

$ php example.php > out.txt
$ ls -l | grep out.txt
-rwxr-xr-x 1 user group 782744 Oct  2 13:57 out.txt
Other Information

No response

Acknowledgements
  • I may be able to implement this feature request
  • This feature might incur a breaking change
SDK version used

3.399.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.3.31/Rocky Linux 10.2

Lingua principale
PHP
Stelle
6.2k
Fork
1.3k
Merge medio
2g 11h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-sdk-php

Tutte le issue di aws/aws-sdk-php

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.