Skip to content

Conversation

@ndossche
Copy link
Member

@ndossche ndossche commented Jan 17, 2026

In a lot of places the return value is not checked, and when the function fails the code continues execution. However, this means that operations on the stack fail and will cause memory leaks on the objects that weren't pushed.

We also notice an inconsistency in how these failures are handled. For example, in one place we explicitly have a fatal error php_error_docref(NULL, E_ERROR, "Memory allocation failure"); but this is the only place to do so.

This was found by a hybrid static-dynamic analyser that looks for inconsistent handling of error checks in bindings.

In a lot of places the return value is not checked, and when the
function fails the code continues execution. However, this means that
operations on the stack fail and will cause memory leaks on the objects
that weren't pushed.

We also notice an inconsistency in how these failures are handled.
For example, in one place we explicitly have a fatal error
`php_error_docref(NULL, E_ERROR, "Memory allocation failure");`
but this is the only place to do so.
@bukka
Copy link
Member

bukka commented Jan 17, 2026

I guess you can just get rid of that warning. In reality it won't likely get printed / visible anyway if there is no memory left...

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants