Skip to content

Conversation

@timurib
Copy link
Contributor

@timurib timurib commented Jun 24, 2018

The memory leak occurs when

  • a ZipArchive is opened with ZipArchive::CREATE|ZipArchive::OVERWRITE flags,
  • it's empty,
  • it's destroyed without explicit close() method call.

The leak does not occur if the zip file already exist. All newer versions are affected too.

Also, it somehow causes a zend_mm_heap corruptions. Unfortunately, I cannot reproduce this on development environment, but my production constantly was crashing until I found the workaround for this bug :)

@tpunt
Copy link
Contributor

tpunt commented Jun 24, 2018

PHP 5.6 (and 7.0) only accept security fixes now, so the lowest this fix can target is PHP 7.1.

Also, could you provide some more information on your setup where you can trigger the heap corruption problems (PHP version and whether ZTS mode is enabled)?

@timurib
Copy link
Contributor Author

timurib commented Jun 25, 2018

Also, could you provide some more information on your setup where you can trigger the heap corruption problems (PHP version and whether ZTS mode is enabled)?

@tpunt, PHP 5.6.36, ZTS disabled.

This doesn't look right to me, it cannot possibly stop a leak, but could very well introduce one ...

@krakjoe, sorry, could you explain why is this fix wrong?

@krakjoe
Copy link
Member

krakjoe commented Jun 25, 2018

Scratch that, my morning brain read the patch the wrong way round, though it was adding the early return, not removing it ... Mondays 😄

@timurib
Copy link
Contributor Author

timurib commented Jun 25, 2018

PHP 5.6 (and 7.0) only accept security fixes now, so the lowest this fix can target is PHP 7.1.

Sorry, I just doubted about status of memory leak bugs.
So, I'll make the patch for 7.1 and open other PR.

@timurib timurib closed this Jun 25, 2018
@timurib timurib deleted the bugfix-76524 branch June 25, 2018 10:38
@tpunt
Copy link
Contributor

tpunt commented Jun 25, 2018

@timurib Do you receive heap corruption issues on PHP 7.1 and higher?

@timurib
Copy link
Contributor Author

timurib commented Jun 25, 2018

@tpunt, unfortunately, I cannot check it: the legacy project, where corruption occurs, is huge and very old, and it's just cannot run on PHP 7. I couldn't find a minimal example to reproduce the crash, but everything works well with workaround to avoid this leak (I replaced the ZipArchive::OVERWRITE flag to manual file handling).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants