Skip to content

Commit bc55177

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 1b9d659 + 07ceadf commit bc55177

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ PHP NEWS
6565
triggers only an Exception on width). (David Carlier)
6666
. Fixed bug GH-17772 (imagepalettetotruecolor crash with memory_limit=2M).
6767
(David Carlier)
68+
. Fixed bug GH-17984 (calls with arguments as array with references).
69+
(David Carlier)
6870

6971
- LDAP:
7072
. Fixed bug GH-17704 (ldap_search fails when $attributes contains a

ext/gd/gd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,7 +3748,7 @@ PHP_FUNCTION(imageconvolution)
37483748
}
37493749

37503750
for (i=0; i<3; i++) {
3751-
if ((var = zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i))) != NULL && Z_TYPE_P(var) == IS_ARRAY) {
3751+
if ((var = zend_hash_index_find_deref(Z_ARRVAL_P(hash_matrix), (i))) != NULL && Z_TYPE_P(var) == IS_ARRAY) {
37523752
if (zend_hash_num_elements(Z_ARRVAL_P(var)) != 3 ) {
37533753
zend_argument_value_error(2, "must be a 3x3 array, matrix[%d] only has %d elements", i, zend_hash_num_elements(Z_ARRVAL_P(var)));
37543754
RETURN_THROWS();
@@ -4061,7 +4061,7 @@ PHP_FUNCTION(imageaffine)
40614061
}
40624062

40634063
for (i = 0; i < nelems; i++) {
4064-
if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) {
4064+
if ((zval_affine_elem = zend_hash_index_find_deref(Z_ARRVAL_P(z_affine), i)) != NULL) {
40654065
switch (Z_TYPE_P(zval_affine_elem)) {
40664066
case IS_LONG:
40674067
affine[i] = Z_LVAL_P(zval_affine_elem);
@@ -4239,7 +4239,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
42394239
}
42404240

42414241
for (i = 0; i < 6; i++) {
4242-
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) {
4242+
if ((tmp = zend_hash_index_find_deref(Z_ARRVAL_P(z_m1), i)) != NULL) {
42434243
switch (Z_TYPE_P(tmp)) {
42444244
case IS_LONG:
42454245
m1[i] = Z_LVAL_P(tmp);
@@ -4256,7 +4256,7 @@ PHP_FUNCTION(imageaffinematrixconcat)
42564256
}
42574257
}
42584258

4259-
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) {
4259+
if ((tmp = zend_hash_index_find_deref(Z_ARRVAL_P(z_m2), i)) != NULL) {
42604260
switch (Z_TYPE_P(tmp)) {
42614261
case IS_LONG:
42624262
m2[i] = Z_LVAL_P(tmp);

ext/gd/tests/gh17984.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
GH-17984: array of references handling
3+
--EXTENSIONS--
4+
gd
5+
--FILE--
6+
<?php
7+
$a = 45;
8+
$matrix = [&$a, 1, 3, 1, 5, 1];
9+
$subarray = [&$a, 0, 0];
10+
$matrix3 = array([0, 0, 0] , &$subarray, [0, 0, 0]);
11+
$src = imagecreatetruecolor(8, 8);
12+
var_dump(imageaffine($src, $matrix));
13+
var_dump(imageaffinematrixconcat($matrix, $matrix));
14+
var_dump(imageconvolution($src, $matrix3, 1.0, 0.0));
15+
$poly = imagecolorallocate($src, 255, 0, 0);
16+
var_dump(imagepolygon($src, array (
17+
&$a, 0,
18+
100, 200,
19+
300, 200
20+
),
21+
$poly));
22+
$style = [&$a, &$a];
23+
var_dump(imagesetstyle($src, $style));
24+
?>
25+
--EXPECT--
26+
object(GdImage)#2 (0) {
27+
}
28+
array(6) {
29+
[0]=>
30+
float(2028)
31+
[1]=>
32+
float(46)
33+
[2]=>
34+
float(138)
35+
[3]=>
36+
float(4)
37+
[4]=>
38+
float(233)
39+
[5]=>
40+
float(7)
41+
}
42+
bool(true)
43+
bool(true)
44+
bool(true)

0 commit comments

Comments
 (0)