Skip to content

Commit 290fb92

Browse files
committed
ext/phar: Mark constant string as static const
1 parent 3f1a444 commit 290fb92

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ext/phar/phar.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,8 @@ int phar_flush(phar_archive_data *phar, char **error) {
25312531
*/
25322532
int phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
25332533
{
2534-
char halt_stub[] = "__HALT_COMPILER();";
2534+
static const char halt_stub[] = "__HALT_COMPILER();";
2535+
25352536
zend_string *newstub;
25362537
phar_entry_info *entry, *newentry;
25372538
size_t halt_offset;

ext/phar/tar.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -957,14 +957,15 @@ static int phar_tar_setupmetadata(zval *zv, void *argument) /* {{{ */
957957

958958
int phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
959959
{
960-
phar_entry_info entry = {0};
961960
static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();";
961+
static const char halt_stub[] = "__HALT_COMPILER();";
962+
963+
phar_entry_info entry = {0};
962964
php_stream *oldfile, *newfile;
963965
bool must_close_old_file = false;
964966
size_t signature_length;
965967
struct _phar_pass_tar_info pass;
966968
char *buf, *signature, sigbuf[8];
967-
char halt_stub[] = "__HALT_COMPILER();";
968969

969970
entry.flags = PHAR_ENT_PERM_DEF_FILE;
970971
entry.timestamp = time(NULL);

ext/phar/zip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
12541254
int phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
12551255
{
12561256
static const char newstub[] = "<?php // zip-based phar archive stub file\n__HALT_COMPILER();";
1257-
char halt_stub[] = "__HALT_COMPILER();";
1257+
static const char halt_stub[] = "__HALT_COMPILER();";
12581258

12591259
php_stream *oldfile;
12601260
bool must_close_old_file = false;

0 commit comments

Comments
 (0)