@@ -2310,28 +2310,29 @@ ZEND_ATTRIBUTE_NONNULL zend_result phar_postprocess_file(phar_entry_data *idata,
23102310 /* verify local file header */
23112311 phar_zip_file_header local ;
23122312 phar_zip_data_desc desc ;
2313+ php_stream * stream = phar_open_archive_fp (idata -> phar );
23132314
2314- if (SUCCESS != phar_open_archive_fp ( idata -> phar ) ) {
2315+ if (! stream ) {
23152316 spprintf (error , 0 , "phar error: unable to open zip-based phar archive \"%s\" to verify local file header for file \"%s\"" ,
23162317 idata -> phar -> fname , ZSTR_VAL (entry -> filename ));
23172318 return FAILURE ;
23182319 }
2319- php_stream_seek (phar_get_entrypfp ( idata -> internal_file ) , entry -> header_offset , SEEK_SET );
2320+ php_stream_seek (stream , entry -> header_offset , SEEK_SET );
23202321
2321- if (sizeof (local ) != php_stream_read (phar_get_entrypfp ( idata -> internal_file ) , (char * ) & local , sizeof (local ))) {
2322+ if (sizeof (local ) != php_stream_read (stream , (char * ) & local , sizeof (local ))) {
23222323 spprintf (error , 0 , "phar error: internal corruption of zip-based phar \"%s\" (cannot read local file header for file \"%s\")" ,
23232324 idata -> phar -> fname , ZSTR_VAL (entry -> filename ));
23242325 return FAILURE ;
23252326 }
23262327
23272328 /* check for data descriptor */
23282329 if (((PHAR_ZIP_16 (local .flags )) & 0x8 ) == 0x8 ) {
2329- php_stream_seek (phar_get_entrypfp ( idata -> internal_file ) ,
2330+ php_stream_seek (stream ,
23302331 entry -> header_offset + sizeof (local ) +
23312332 PHAR_ZIP_16 (local .filename_len ) +
23322333 PHAR_ZIP_16 (local .extra_len ) +
23332334 entry -> compressed_filesize , SEEK_SET );
2334- if (sizeof (desc ) != php_stream_read (phar_get_entrypfp ( idata -> internal_file ) ,
2335+ if (sizeof (desc ) != php_stream_read (stream ,
23352336 (char * ) & desc , sizeof (desc ))) {
23362337 spprintf (error , 0 , "phar error: internal corruption of zip-based phar \"%s\" (cannot read local data descriptor for file \"%s\")" ,
23372338 idata -> phar -> fname , ZSTR_VAL (entry -> filename ));
0 commit comments