← Problems

count() TypeError crashes PDF export on PHP 8

PDF generation crashes with a count() TypeError when a string is passed where an array is expected.

Tier II · Emerging Problems that are still building up.

3 public reports · first reported 20 February 2025 · last reported 25 December 2025

Idea report · $9 · No contacts · All sales final

See a sample idea report

What's going wrong

Several site owners on PHP 8 report that exporting a page to PDF stops with a TypeError, saying count received a string where an array or Countable was expected.

AI-assisted: written with the help of AI from the reports. The idea report has the full summary.

In the idea report

  • The full summary.
  • The products the 3 reports are about, and how many came each month.
  • Related problems.

No business has been found with this problem yet, so the report has no contacts. All sales are final — no refunds. Pricing.