mapResourceToString(parent::fetchNumeric()); } /** * {@inheritDoc} */ public function fetchAssociative(): array|false { return $this->mapResourceToString(parent::fetchAssociative()); } /** * {@inheritDoc} */ public function fetchOne(): mixed { return $this->mapResourceToString(parent::fetchOne()); } /** * {@inheritDoc} */ public function fetchAllNumeric(): array { $data = $this->mapResourceToString(parent::fetchAllNumeric()); assert(is_array($data)); return array_map($this->mapResourceToString(...), $data); } /** * {@inheritDoc} */ public function fetchAllAssociative(): array { $data = $this->mapResourceToString(parent::fetchAllAssociative()); assert(is_array($data)); return array_map($this->mapResourceToString(...), $data); } /** * {@inheritDoc} */ public function fetchFirstColumn(): array { $data = $this->mapResourceToString(parent::fetchFirstColumn()); assert(is_array($data)); return array_map($this->mapResourceToString(...), $data); } /** * Map resources to string like is done for e.g. in mysqli driver * * @param mixed $record * @return mixed */ protected function mapResourceToString($record) { if (is_array($record)) { foreach ($record as $k => $value) { if (is_resource($value)) { $record[$k] = stream_get_contents($value); } } } return $record; } }