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