Skip to content

Commit 7b113d7

Browse files
committed
PHAR should modify entry timestamp when it's modified
1 parent bc55a8e commit 7b113d7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/phar/stream.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,11 @@ static int phar_stream_flush(php_stream *stream TSRMLS_DC) /* {{{ */
458458
{
459459
char *error;
460460
int ret;
461-
if (stream->mode[0] == 'w' || (stream->mode[0] == 'r' && stream->mode[1] == '+')) {
462-
ret = phar_flush(((phar_entry_data *)stream->abstract)->phar, 0, 0, 0, &error TSRMLS_CC);
461+
phar_entry_data *data = (phar_entry_data *) stream->abstract;
462+
463+
if (data->internal_file->is_modified) {
464+
data->internal_file->timestamp = time(0);
465+
ret = phar_flush(data->phar, 0, 0, 0, &error TSRMLS_CC);
463466
if (error) {
464467
php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS TSRMLS_CC, "%s", error);
465468
efree(error);

0 commit comments

Comments
 (0)