27
27
static void destroy_phar_data (void * pDest );
28
28
29
29
ZEND_DECLARE_MODULE_GLOBALS (phar )
30
- #if PHP_VERSION_ID >= 50300
31
30
char * (* phar_save_resolve_path )(const char * filename , int filename_len TSRMLS_DC );
32
- #endif
33
31
34
32
/**
35
33
* set's phar->is_writeable based on the current INI value
@@ -3321,31 +3319,18 @@ static size_t phar_zend_stream_reader(void *handle, char *buf, size_t len TSRMLS
3321
3319
}
3322
3320
/* }}} */
3323
3321
3324
- #if PHP_VERSION_ID >= 50300
3325
3322
static size_t phar_zend_stream_fsizer (void * handle TSRMLS_DC ) /* {{{ */
3326
3323
{
3327
3324
return ((phar_archive_data * )handle )-> halt_offset + 32 ;
3328
3325
} /* }}} */
3329
3326
3330
- #else /* PHP_VERSION_ID */
3331
-
3332
- static long phar_stream_fteller_for_zend (void * handle TSRMLS_DC ) /* {{{ */
3333
- {
3334
- return (long )php_stream_tell (phar_get_pharfp ((phar_archive_data * )handle TSRMLS_CC ));
3335
- }
3336
- /* }}} */
3337
- #endif
3338
-
3339
3327
zend_op_array * (* phar_orig_compile_file )(zend_file_handle * file_handle , int type TSRMLS_DC );
3340
- #if PHP_VERSION_ID >= 50300
3341
3328
#define phar_orig_zend_open zend_stream_open_function
3329
+
3342
3330
static char * phar_resolve_path (const char * filename , int filename_len TSRMLS_DC )
3343
3331
{
3344
3332
return phar_find_in_include_path ((char * ) filename , filename_len , NULL TSRMLS_CC );
3345
3333
}
3346
- #else
3347
- int (* phar_orig_zend_open )(const char * filename , zend_file_handle * handle TSRMLS_DC );
3348
- #endif
3349
3334
3350
3335
static zend_op_array * phar_compile_file (zend_file_handle * file_handle , int type TSRMLS_DC ) /* {{{ */
3351
3336
{
@@ -3378,7 +3363,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
3378
3363
}
3379
3364
} else if (phar -> flags & PHAR_FILE_COMPRESSION_MASK ) {
3380
3365
/* compressed phar */
3381
- #if PHP_VERSION_ID >= 50300
3382
3366
file_handle -> type = ZEND_HANDLE_STREAM ;
3383
3367
/* we do our own reading directly from the phar, don't change the next line */
3384
3368
file_handle -> handle .stream .handle = phar ;
@@ -3390,18 +3374,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
3390
3374
php_stream_rewind (PHAR_GLOBALS -> cached_fp [phar -> phar_pos ].fp ) :
3391
3375
php_stream_rewind (phar -> fp );
3392
3376
memset (& file_handle -> handle .stream .mmap , 0 , sizeof (file_handle -> handle .stream .mmap ));
3393
- #else /* PHP_VERSION_ID */
3394
- file_handle -> type = ZEND_HANDLE_STREAM ;
3395
- /* we do our own reading directly from the phar, don't change the next line */
3396
- file_handle -> handle .stream .handle = phar ;
3397
- file_handle -> handle .stream .reader = phar_zend_stream_reader ;
3398
- file_handle -> handle .stream .closer = NULL ; /* don't close - let phar handle this one */
3399
- file_handle -> handle .stream .fteller = phar_stream_fteller_for_zend ;
3400
- file_handle -> handle .stream .interactive = 0 ;
3401
- phar -> is_persistent ?
3402
- php_stream_rewind (PHAR_GLOBALS -> cached_fp [phar -> phar_pos ].fp ) :
3403
- php_stream_rewind (phar -> fp );
3404
- #endif
3405
3377
}
3406
3378
}
3407
3379
}
@@ -3426,60 +3398,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
3426
3398
}
3427
3399
/* }}} */
3428
3400
3429
- #if PHP_VERSION_ID < 50300
3430
- int phar_zend_open (const char * filename , zend_file_handle * handle TSRMLS_DC ) /* {{{ */
3431
- {
3432
- char * arch , * entry ;
3433
- int arch_len , entry_len ;
3434
-
3435
- /* this code is obsoleted in php 5.3 */
3436
- entry = (char * ) filename ;
3437
- if (!IS_ABSOLUTE_PATH (entry , strlen (entry )) && !strstr (entry , "://" )) {
3438
- phar_archive_data * * pphar = NULL ;
3439
- char * fname ;
3440
- int fname_len ;
3441
-
3442
- fname = (char * )zend_get_executed_filename (TSRMLS_C );
3443
- fname_len = strlen (fname );
3444
-
3445
- if (fname_len > 7 && !strncasecmp (fname , "phar://" , 7 )) {
3446
- if (SUCCESS == phar_split_fname (fname , fname_len , & arch , & arch_len , & entry , & entry_len , 1 , 0 TSRMLS_CC )) {
3447
- zend_hash_find (& (PHAR_GLOBALS -> phar_fname_map ), arch , arch_len , (void * * ) & pphar );
3448
- if (!pphar && PHAR_G (manifest_cached )) {
3449
- zend_hash_find (& cached_phars , arch , arch_len , (void * * ) & pphar );
3450
- }
3451
- efree (arch );
3452
- efree (entry );
3453
- }
3454
- }
3455
-
3456
- /* retrieving an include within the current directory, so use this if possible */
3457
- if (!(entry = phar_find_in_include_path ((char * ) filename , strlen (filename ), NULL TSRMLS_CC ))) {
3458
- /* this file is not in the phar, use the original path */
3459
- goto skip_phar ;
3460
- }
3461
-
3462
- if (SUCCESS == phar_orig_zend_open (entry , handle TSRMLS_CC )) {
3463
- if (!handle -> opened_path ) {
3464
- handle -> opened_path = entry ;
3465
- }
3466
- if (entry != filename ) {
3467
- handle -> free_filename = 1 ;
3468
- }
3469
- return SUCCESS ;
3470
- }
3471
-
3472
- if (entry != filename ) {
3473
- efree (entry );
3474
- }
3475
-
3476
- return FAILURE ;
3477
- }
3478
- skip_phar :
3479
- return phar_orig_zend_open (filename , handle TSRMLS_CC );
3480
- }
3481
- /* }}} */
3482
- #endif
3483
3401
typedef zend_op_array * (zend_compile_t )(zend_file_handle * , int TSRMLS_DC );
3484
3402
typedef zend_compile_t * (compile_hook )(zend_compile_t * ptr );
3485
3403
@@ -3556,13 +3474,8 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */
3556
3474
phar_orig_compile_file = zend_compile_file ;
3557
3475
zend_compile_file = phar_compile_file ;
3558
3476
3559
- #if PHP_VERSION_ID >= 50300
3560
3477
phar_save_resolve_path = zend_resolve_path ;
3561
3478
zend_resolve_path = phar_resolve_path ;
3562
- #else
3563
- phar_orig_zend_open = zend_stream_open_function ;
3564
- zend_stream_open_function = phar_zend_open ;
3565
- #endif
3566
3479
3567
3480
phar_object_init (TSRMLS_C );
3568
3481
@@ -3583,11 +3496,6 @@ PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
3583
3496
zend_compile_file = phar_orig_compile_file ;
3584
3497
}
3585
3498
3586
- #if PHP_VERSION_ID < 50300
3587
- if (zend_stream_open_function == phar_zend_open ) {
3588
- zend_stream_open_function = phar_orig_zend_open ;
3589
- }
3590
- #endif
3591
3499
if (PHAR_G (manifest_cached )) {
3592
3500
zend_hash_destroy (& (cached_phars ));
3593
3501
zend_hash_destroy (& (cached_alias ));
0 commit comments