Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with PHP 8.3 and in-memory-stream. #646

Open
temp opened this issue Jan 3, 2024 · 3 comments
Open

Problem with PHP 8.3 and in-memory-stream. #646

temp opened this issue Jan 3, 2024 · 3 comments

Comments

@temp
Copy link

temp commented Jan 3, 2024

I'm having problems with imagick and in-memory-streams on PHP 8.3.
Here are two test cases, one with in-memory-stream, which results in an error, one with a file-stream, this one works fine.
Both throw NO error on PHP 8.2.

File 1:

<?php

$stream = fopen('php://memory', 'wb+');

$image = new Imagick('magick:rose');
$image->setImageFormat('jpg');
$image->writeImageFile($stream);

rewind($stream);

$image = new Imagick();
$image->readImageFile($stream);

echo 'done'.PHP_EOL;

Run File 1:

$ php test1.php
PHP Fatal error:  Uncaught ImagickException: no decode delegate for this image format `' @ error/constitute.c/ReadImage/746 in /app/test1.php:11
Stack trace:
#0 /app/test1.php(11): Imagick->readImageFile()
#1 {main}
  thrown in /app/test1.php on line 11

File 2:

<?php

$stream = fopen('/tmp/test.jpg', 'wb+');

$image = new Imagick('magick:rose');
$image->setImageFormat('jpg');
$image->writeImageFile($stream);

rewind($stream);

$image = new Imagick();
$image->readImageFile($stream);

echo 'done'.PHP_EOL;

Run File 2:

$ php test2.php
done

JPG support is enabled:

php --ri imagick

imagick

imagick module => enabled
imagick module version => @PACKAGE_VERSION@
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.1.1-22 Q16-HDRI aarch64 21779 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.1.1-22 Q16-HDRI aarch64 21779 https://imagemagick.org
ImageMagick copyright => (C) 1999 ImageMagick Studio LLC
ImageMagick release date => 2023-12-03
ImageMagick number of supported formats:  => 219
ImageMagick supported formats => 3G2, 3GP, AAI, AI, APNG, ART, ASHLAR, AVI, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CUBE, CUR, CUT, DATA, DCM, DCX, DDS, DFONT, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MPO, MSL, MTV, MVG, NULL, ORA, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAS, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, STEGANO, STRIMG, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, XBM, XC, XCF, XPM, XPS, XV, XWD, YAML, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0
imagick.skip_version_check => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.set_single_thread => 1 => 1
imagick.shutdown_sleep_count => 10 => 10
imagick.allow_zero_dimension_images => 0 => 0
@temp
Copy link
Author

temp commented Jan 15, 2024

Additional info: On my mac the error does not occur with php 8.3, the ImageMagick Version is 6.9.x, the error occurs in a docker container with the official docker php image, and manually compiled imagick extension (which uses ImageMagick 7.1.x, as seen above).

@temp temp changed the title Problem with PHO 8.3 and in-memory-stream. Problem with PHP 8.3 and in-memory-stream. Jan 16, 2024
@Danack
Copy link
Collaborator

Danack commented Feb 9, 2024

Hi,

I'm unable to reproduce this with PHP 8.3.2

Is it still an issue for you?

the error occurs in a docker container with the official docker php image

Just to note, the 'official docker php image' is made by Docker, not by anyone to do with the PHP team.

@temp
Copy link
Author

temp commented Feb 29, 2024

Thanks for your answer, Danack. Yes, this should probably be reported to docker-php. I will wait until a version of Imagick is released that is compatible with 8.3.
I will use this issue here to provide 2 phpt-tests, if this is fine for you, that will demonstrate the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants