Open
Description
Version(s) affected
2.6
Description
The benchmark script (tests/benchmark/benchmark.php
) failed to run when user specified a non-exist output csv file via php tests/benchmark/benchmark.php --csv non-exist.csv
.
How to reproduce
Dockerfile for reproduce
FROM php:8.4-alpine
# Install dependencies
RUN apk add --no-cache git
# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# Clone project
WORKDIR /app
RUN git \
clone \
https://github.com/thephpleague/commonmark \
--branch=2.6.1 \
--depth=1 \
/app
RUN composer install
# Run the benchmark
ENTRYPOINT [ "sh", "-c", "php tests/benchmark/benchmark.php --csv benchmark.csv" ]
Current output
$ docker build . -t commonmark && docker run --rm -it commonmark
docker build . -t commonmark && docker run --rm -it commonmark
[+] Building 1.2s (12/12) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 471B 0.0s
=> => writing image sha256:931f9a3465f1a4d16eb0913c1ae8904054537d47d4ebaf681adad5c6427d5861 0.0s
=> => naming to docker.io/library/commonmark 0.0s
Fatal error: Uncaught ValueError: Path must not be empty in /app/tests/benchmark/benchmark.php:123
Stack trace:
#0 /app/tests/benchmark/benchmark.php(123): fopen('', 'w+')
#1 {main}
thrown in /app/tests/benchmark/benchmark.php on line 123
Expected output
$ docker build . -t commonmark && docker run --rm -it commonmark
Benchmark Results, CPU:
1) cebe/markdown 1.51 ms
2) Parsedown 1.64 ms -0.13 ms
3) cebe/markdown extra 1.80 ms -0.29 ms
4) cebe/markdown gfm 1.89 ms -0.38 ms
5) PHP Markdown 2.05 ms -0.54 ms
6) PHP Markdown Extra 2.95 ms -1.44 ms
7) CommonMark 5.74 ms -4.23 ms
8) CommonMark GFM 5.96 ms -4.45 ms
9) CommonMark All Extensions 8.29 ms -6.78 ms
Possible solution
commonmark/tests/benchmark/benchmark.php
Lines 118 to 127 in 64cba7f
Change realpath($config['csv']);
to $config['csv'];
.
Additional context
No response
Did this project help you today? Did it make you happy in any way?
No response
Metadata
Metadata
Assignees
Labels
No labels