# ext/standard/tests/http/bug60570.phpt failure

- Thread: https://externals.io/message/76706
- Original archive: https://news-web.php.net/php.internals/76706
- Started by Dmitry Stogov on 2014-08-19T14:10:02+00:00
- Messages: 10
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #76706 — Dmitry Stogov — 2014-08-19T14:10:02+00:00

URL: https://externals.io/message/76706#76706

Hi,

Yesterday we discussed with Nikta the failure of
ext/standard/tests/http/bug60570.phpt. It was in context of AST patch, but
the failure is not related to AST at all. It's just a bad test that makes
wrong assumption.

Resource leaks can't be caught using get_memory_usage().

To have a robust way to detect resource leaks I propose a new function -
 `get_resources()` that returns an array of all registered resources or an
array of registered resources of particular type. See patch:

https://gist.github.com/dstogov/f96c04f5979e726909ab

I'm not sure if such small change needs RFC.

Thoughts?

Thanks. Dmitry.

---

## #76707 — Pierre Joye — 2014-08-19T16:36:46+00:00

URL: https://externals.io/message/76706#76707 · In reply to: #76706

hi,


> Hi,
>
> Yesterday we discussed with Nikta the failure of
> ext/standard/tests/http/bug60570.phpt. It was in context of AST patch, but
> the failure is not related to AST at all. It's just a bad test that makes
> wrong assumption.
>
> Resource leaks can't be caught using get_memory_usage().
>
> To have a robust way to detect resource leaks I propose a new function -
> `get_resources()` that returns an array of all registered resources or an
> array of registered resources of particular type. See patch:
>
> https://gist.github.com/dstogov/f96c04f5979e726909ab
>
> I'm not sure if such small change needs RFC.
>
> Thoughts?

It is mainly a debugging function, self contained, etc...

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #76712 — Laruence — 2014-08-20T02:48:51+00:00

URL: https://externals.io/message/76706#76712 · In reply to: #76706

Hey:



> Hi,
>
> Yesterday we discussed with Nikta the failure of
> ext/standard/tests/http/bug60570.phpt. It was in context of AST patch, but
> the failure is not related to AST at all. It's just a bad test that makes
> wrong assumption.
>
> Resource leaks can't be caught using get_memory_usage().
>
> To have a robust way to detect resource leaks I propose a new function -
> `get_resources()` that returns an array of all registered resources or an
> array of registered resources of particular type. See patch:
>
> https://gist.github.com/dstogov/f96c04f5979e726909ab
>
> I'm not sure if such small change needs RFC.
>
> Thoughts?
I think it's okey to have a such function.

we have get_defined_functions/constants/vars

thanks
>
> Thanks. Dmitry.



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #76715 — Dmitry Stogov — 2014-08-20T05:24:17+00:00

URL: https://externals.io/message/76706#76715 · In reply to: #76712

Anyone objects about it or thinks it needs RFC?

Thanks. Dmitry.




> Hey:
>
>
> 
> > […]
> but
> > […]
> I think it's okey to have a such function.
>
> we have get_defined_functions/constants/vars
>
> thanks
> > […]
>
>
>
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/

---

## #76717 — Pierre Joye — 2014-08-20T07:37:41+00:00

URL: https://externals.io/message/76706#76717 · In reply to: #76715

> Anyone objects about it or thinks it needs RFC?

No, goahead :)

-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #76720 — Julien Pauli — 2014-08-20T09:12:45+00:00

URL: https://externals.io/message/76706#76720 · In reply to: #76715

> Anyone objects about it or thinks it needs RFC?
>
> Thanks. Dmitry.
>
>
> 
>
> > […]

I would have then called it get_defined_resources() , for consistency.

Julien.P

---

## #76727 — Dmitry Stogov — 2014-08-20T10:08:46+00:00

URL: https://externals.io/message/76706#76727 · In reply to: #76720

The are not defined.
They are open (or closed but not freed yet).

You probably meant get_defined_resorce_types()

Thanks. Dmitry.




> 
> > […]
> wrote:
> > […]
> makes
> > […]
> function -
> > […]
> an
> > […]
>
> I would have then called it get_defined_resources() , for consistency.
>
> Julien.P

---

## #76739 — Markus Fischer — 2014-08-20T18:51:01+00:00

URL: https://externals.io/message/76706#76739 · In reply to: #76727

Hello Dmitry,


> To have a robust way to detect resource leaks I propose a new
> function -
> `get_resources()` that returns an array of all registered resources or
> an
> array of registered resources of particular type. See patch:
>
> https://gist.github.com/dstogov/f96c04f5979e726909ab

my only concern would be the naming? Is there a policy for introducing
new global symbols in PHP? Looking at "get_resources" it doesn't look
far way from "get_header" or similar related stuff.

A quick search on github should only some very very few results so it's
probably statistically irrelevant. I was just wondering in general how
introducing global symbols without documented patterns (like __...
methods) works?

thank you,
- Markus

---

## #76744 — Stas Malyshev — 2014-08-20T20:50:55+00:00

URL: https://externals.io/message/76706#76744 · In reply to: #76706

Hi!

> array of registered resources of particular type. See patch:
> 
> https://gist.github.com/dstogov/f96c04f5979e726909ab

It would be better as a pull, it's be easier to comment on it.
For the function get_resources, the proto says it has no arguments, but
it actually has one S argument that is not documented. Could you add a
proto for it?

> I'm not sure if such small change needs RFC.

I don't think so, seems to be pretty non-controversial.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/

---

## #76746 — Dmitry Stogov — 2014-08-21T05:50:54+00:00

URL: https://externals.io/message/76706#76746 · In reply to: #76744

done.

Dmitry.


On Thu, Aug 21, 2014 at 12:50 AM, Stas Malyshev <smalyshev@sugarcrm.com>
wrote:

> Hi!
>
> > […]
>
> It would be better as a pull, it's be easier to comment on it.
> For the function get_resources, the proto says it has no arguments, but
> it actually has one S argument that is not documented. Could you add a
> proto for it?
>
> > […]
>
> I don't think so, seems to be pretty non-controversial.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
