Skip to content

fix(handler): getException() returning null breaks trace building #17

@usernane

Description

@usernane

Description

In production, getException() returns null for security. However, setTrace() calls getException() internally, which breaks trace building in production environments.

Current State

// In AbstractHandler.php
public function getException(): ?Throwable {
    if (!$this->security->allowRawExceptionAccess()) {
        return null;  // Returns null in production
    }
    return $this->exception;
}

private function setTrace(): void {
    $ex = $this->getException();  // Gets null in production!
    
    if ($ex === null) {
        $this->traceArr = [];  // Trace is empty in production
        return;
    }
    // ... trace building never happens
}

Implementation Details

  • Use private $this->exception property directly in setTrace() instead of getException()
  • Keep getException() security behavior for public access only

Acceptance Criteria

  • Trace builds correctly in all environments
  • Production still blocks raw exception access via public getException() method
  • Add test for production trace building

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions