Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment::increaseMemoryLimitTo() cannot increase memory to "unlimited" #8570

Closed
wernerkrauss opened this issue Nov 5, 2018 · 3 comments

Comments

@wernerkrauss
Copy link
Contributor

Affected Version

4.2.1

Description

I cannot increase memory (e.g. in a dev task) to "unlimited", cause "-1" get's convertet to "1".

Steps to Reproduce

Step debugger on Environment::increaseTimeLimitTo();

after it calls Convert::memstring2bytes() the default string of "-1", which means "unlimited" is convertet to an integer "1".

This regex in Convert::memstring2bytes() removes the minus sign:

grafik

Questions: Who is repsonsible to preserve the "-1" ? Should the logic go to the convert method or should increaseMemoryLimitTo handle that?

I'd vote for convert, what do the core commiters think about it?

As most of the time I'm happy to create a PR for that small but annoying issue

@wernerkrauss
Copy link
Contributor Author

This also affects Environment::setMemoryLimitMax(), as it also runs Convert::memstring2bytes

@robbieaverill
Copy link
Contributor

Questions: Who is repsonsible to preserve the "-1" ? Should the logic go to the convert method or should increaseMemoryLimitTo handle that?

I think so, but Environment::increaseMemoryLimitTo() is an existing implementation that is passing it -1 already, so perhaps that method needs to be changed to handle (and return) -1

@wernerkrauss
Copy link
Contributor Author

@robbieaverill changing increaseMemoryLimitTo won't help, as it also checks getTimeLimitMax(). And when I cannot set maximum memory limit to "-1" as it get's convertet to "1" by the Convert method it won't work.

IMHO Convert::memstring2bytes() is responsible to preserve the negative integer value as it's

  1. used all the time while setting and getting the different memory related values
  2. "-1" can be seen as valid memory string which means "infinite" or "all you can eat" according to the php docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants