On 20/10/2025 10:16, Hans Krentel wrote:
So, there would indeed be a change compared to my earlier answer: I now
propose using only uppercase names for constant resolution (and thus for
the warning you asked about). This would mean:

- Allowing unquoted strings with lowercase characters to pass through
   unchanged.

- Restricting constant name resolution to a pattern like:

     CONSTANT_NAME [A-Z_][A-Z0-9_]*

   ...possibly with a minimum length greater than one, as shown.


I don't think this kind of pattern matching is the right way to go. It's perfectly normal in INI files to have all sorts of strings which aren't quoted; looking through the samples provided in the source, I spotted this:

user_agent=PHP

No regex is going to recognise that that should be interpreted as "PHP", not constant("PHP").


As I think I mentioned in an earlier message, the specific problem raised seems to be more to do with string-to-int conversion, rather than the INI parsing itself. Even if the invalid constant is surrounded by quotes, this is not a useful setting:

error_reporting = "X_ERROR"|E_WARNING|E_PARSE|E_NOTICE

Maybe the part of the parser that handles *operators* is what needs a behaviour change instead?


--
Rowan Tommins
[IMSoP]

Reply via email to