On Di, 2019-02-12 at 10:29 -0500, Bishop Bettini wrote:
> Would it make sense to update is_resource
> (and friends) to be aware that "resources" returned from xml_parser_*
> are not resources proper, but rather resources nominal?
> 
> If userland needed to strictly determine what was a resource proper
> and what was a resource nominal, we could improve the signature:
> is_resource(mixed $var, bool $strict = false). But, honestly, the
> aforementioned opaqueness makes me think this wouldn't be necessary.

How do you distinguish an object with a "resource" from one not
representing such a thing?

- Any object?
- All internal ones?
- Add a class_entry flag?
- Hardcode a list?

None of those really make sense to me.

The `is_*` routines look at PHP's type system, the information for
general use is limited (we don't have ReflectionResource as well ...
while that couldn't do much anyways as a resource is only a void*)

The only use case here seems to be

   $foo = xml_*();
   if (!s_resource($foo)) error();

Which is limited, since the only xml function returning a resource
seems to be xml_parser_create() which will always succeed (except out
of memory or similar)

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to