[php-src] master: Merge branch 'PHP-8.6'

From: Date: Sun, 04 Oct 2026 15:25:05 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141920@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-10-04T11:15:08-04:00 Commit: https://github.com/php/php-src/commit/dbbbf6e2adb7b5747230193e2ab8acc15538ecd4 Raw diff: https://github.com/php/php-src/commit/dbbbf6e2adb7b5747230193e2ab8acc15538ecd4.diff Merge branch 'PHP-8.6' * PHP-8.6: ext/standard: Keep IPTC headers local to each call Changed paths: A ext/standard/tests/image/iptcembed_reentrant.phpt M ext/standard/iptc.c Diff: diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 59db612a7337..302892367b10 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -173,11 +173,10 @@ static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf, c } /* }}} */ -static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; - /* {{{ Embed binary IPTC data into a JPEG image. */ PHP_FUNCTION(iptcembed) { + char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; char *iptcdata, *jpeg_file; size_t iptcdata_len, jpeg_file_len; zend_long spool = 0; diff --git a/ext/standard/tests/image/iptcembed_reentrant.phpt b/ext/standard/tests/image/iptcembed_reentrant.phpt new file mode 100644 index 000000000000..758e50378b02 --- /dev/null +++ b/ext/standard/tests/image/iptcembed_reentrant.phpt @@ -0,0 +1,34 @@ +--TEST-- +iptcembed() keeps APP13 headers local during reentrant output handling +--FILE-- +<?php +$file = __DIR__ . '/iptcembed_reentrant.jpg'; +file_put_contents($file, "\xff\xd8\xff\xe0\x00\x02\xff\xda\x00\x02"); +$output = ''; +$nested = false; +ob_start(function ($chunk) use (&$output, &$nested, $file) { + $output .= $chunk; + if (!$nested && str_ends_with($output, "\xff\xed")) { + $nested = true; + iptcembed(str_repeat('B', 256), $file, 0); + } + return ''; +}, 1); +iptcembed('AA', $file, 2); +ob_end_flush(); +$start = strpos($output, "\xff\xed"); +echo "Nested call: "; +var_dump($nested); +echo "APP13 length: "; +var_dump(unpack('n', substr($output, $start + 2, 2))[1]); +echo "Outer payload: "; +var_dump(substr($output, $start + 30, 2)); +?> +--CLEAN-- +<?php +unlink(__DIR__ . '/iptcembed_reentrant.jpg'); +?> +--EXPECT-- +Nested call: bool(true) +APP13 length: int(30) +Outer payload: string(2) "AA"

« previous php.cvs (#141920) next »