beganovich / beganovich/snappdf

Fatal Error - Uncaught ValueError

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
221
Forks
18
Avg merge
2h 11m
Merged PRs (30d)
1

Description

Hello

I am getting an error:

Fatal error: Uncaught ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes in E:\xampp\htdocs\testing\pdf_headless_chrome\vendor\beganovich\snappdf\src\Snappdf.php:296 Stack trace: #0 E:\xampp\htdocs\testing\pdf_headless_chrome\vendor\beganovich\snappdf\src\Snappdf.php(296): file_get_contents('%PDF-1.4\n%\xD3\xEB\xE9\xE1\n...') #1 E:\xampp\htdocs\testing\pdf_headless_chrome\vendor\beganovich\snappdf\src\Snappdf.php(252): Beganovich\Snappdf\Snappdf->executeOnWindows(Array, 'C:\\Users\\nitin....', Array) #2 E:\xampp\htdocs\testing\pdf_headless_chrome\vendor\beganovich\snappdf\src\Snappdf.php(272): Beganovich\Snappdf\Snappdf->generate() #3 E:\xampp\htdocs\testing\pdf_headless_chrome\test.php(22): Beganovich\Snappdf\Snappdf->save('filetest.pdf') #4 {main} thrown in E:\xampp\htdocs\testing\pdf_headless_chrome\vendor\beganovich\snappdf\src\Snappdf.php on line 296

My code is:

include 'vendor/autoload.php';
$snappdf = new \Beganovich\Snappdf\Snappdf();

$pdf = $snappdf
->setHtml('Hello world')
->save('filetest.pdf');

Please help.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with vendor/beganovich/snappdf/src/Snappdf.php around lines 252, 272, and 296, following the save() and generate() path used by test.php. Reproduce the Windows setHtml('Hello world')->save('filetest.pdf') example and inspect the value passed to file_get_contents(); done means the example completes without the reported ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.