@@ -1296,14 +1296,14 @@ PHP_FUNCTION(image_type_to_extension)
1296
1296
1297
1297
/* {{{ php_imagetype
1298
1298
detect filetype from first bytes */
1299
- PHPAPI int php_getimagetype (php_stream * stream , char * filetype )
1299
+ PHPAPI int php_getimagetype (php_stream * stream , char * input , char * filetype )
1300
1300
{
1301
1301
char tmp [12 ];
1302
1302
int twelve_bytes_read ;
1303
1303
1304
1304
if ( !filetype ) filetype = tmp ;
1305
1305
if ((php_stream_read (stream , filetype , 3 )) != 3 ) {
1306
- php_error_docref (NULL , E_NOTICE , "Read error!" );
1306
+ php_error_docref (NULL , E_NOTICE , "Error reading from %s!" , input );
1307
1307
return IMAGE_FILETYPE_UNKNOWN ;
1308
1308
}
1309
1309
@@ -1314,7 +1314,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
1314
1314
return IMAGE_FILETYPE_JPEG ;
1315
1315
} else if (!memcmp (filetype , php_sig_png , 3 )) {
1316
1316
if (php_stream_read (stream , filetype + 3 , 5 ) != 5 ) {
1317
- php_error_docref (NULL , E_NOTICE , "Read error!" );
1317
+ php_error_docref (NULL , E_NOTICE , "Error reading from %s!" , input );
1318
1318
return IMAGE_FILETYPE_UNKNOWN ;
1319
1319
}
1320
1320
if (!memcmp (filetype , php_sig_png , 8 )) {
@@ -1335,7 +1335,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
1335
1335
return IMAGE_FILETYPE_JPC ;
1336
1336
} else if (!memcmp (filetype , php_sig_riff , 3 )) {
1337
1337
if (php_stream_read (stream , filetype + 3 , 9 ) != 9 ) {
1338
- php_error_docref (NULL , E_NOTICE , "Read error!" );
1338
+ php_error_docref (NULL , E_NOTICE , "Error reading from %s!" , input );
1339
1339
return IMAGE_FILETYPE_UNKNOWN ;
1340
1340
}
1341
1341
if (!memcmp (filetype + 8 , php_sig_webp , 4 )) {
@@ -1346,7 +1346,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
1346
1346
}
1347
1347
1348
1348
if (php_stream_read (stream , filetype + 3 , 1 ) != 1 ) {
1349
- php_error_docref (NULL , E_NOTICE , "Read error!" );
1349
+ php_error_docref (NULL , E_NOTICE , "Error reading from %s!" , input );
1350
1350
return IMAGE_FILETYPE_UNKNOWN ;
1351
1351
}
1352
1352
/* BYTES READ: 4 */
@@ -1373,7 +1373,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
1373
1373
return IMAGE_FILETYPE_WBMP ;
1374
1374
}
1375
1375
if (!twelve_bytes_read ) {
1376
- php_error_docref (NULL , E_NOTICE , "Read error!" );
1376
+ php_error_docref (NULL , E_NOTICE , "Error reading from %s!" , input );
1377
1377
return IMAGE_FILETYPE_UNKNOWN ;
1378
1378
}
1379
1379
if (php_get_xbm (stream , NULL )) {
@@ -1383,7 +1383,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
1383
1383
}
1384
1384
/* }}} */
1385
1385
1386
- static void php_getimagesize_from_stream (php_stream * stream , zval * info , INTERNAL_FUNCTION_PARAMETERS ) /* {{{ */
1386
+ static void php_getimagesize_from_stream (php_stream * stream , char * input , zval * info , INTERNAL_FUNCTION_PARAMETERS ) /* {{{ */
1387
1387
{
1388
1388
int itype = 0 ;
1389
1389
struct gfxinfo * result = NULL ;
@@ -1392,7 +1392,7 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA
1392
1392
RETURN_FALSE ;
1393
1393
}
1394
1394
1395
- itype = php_getimagetype (stream , NULL );
1395
+ itype = php_getimagetype (stream , input , NULL );
1396
1396
switch ( itype ) {
1397
1397
case IMAGE_FILETYPE_GIF :
1398
1398
result = php_handle_gif (stream );
@@ -1511,7 +1511,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
1511
1511
RETURN_FALSE ;
1512
1512
}
1513
1513
1514
- php_getimagesize_from_stream (stream , info , INTERNAL_FUNCTION_PARAM_PASSTHRU );
1514
+ php_getimagesize_from_stream (stream , input , info , INTERNAL_FUNCTION_PARAM_PASSTHRU );
1515
1515
php_stream_close (stream );
1516
1516
}
1517
1517
/* }}} */
0 commit comments