# Help with object creation

- Thread: https://externals.io/message/20199
- Original archive: https://news-web.php.net/php.internals/20199
- Started by Bob Silva on 2005-11-20T17:55:49+00:00
- Messages: 2
- 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

---

## #20199 — Bob Silva — 2005-11-20T17:55:49+00:00

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

Looking through the source, there are a few extensions which create objects
internally and when they do this (usually with an instanciate method), they
typically set is_ref == 1. Like so:

 

object_init_ex(object, class_entry);

object->refcount = 1;

object->is_ref = 1;

 

 

Why set the is_ref? Aren't objects treated as is_ref natively throughout the
engine? Or is this just old code from PHP 4 days that is still hanging
around?

 

Thanks for the understanding.

 

Bob Silva

---

## #20205 — Marcus Boerger — 2005-11-20T20:40:06+00:00

URL: https://externals.io/message/20199#20205 · In reply to: #20199

Hello Bob,

  in php 4 that prevents a useless copy after new (and dont't ask why).
Since your stuff is php 5 only you should make that is_ref=0.

marcus

Sunday, November 20, 2005, 6:55:49 PM, you wrote:

> Looking through the source, there are a few extensions which create objects
> internally and when they do this (usually with an instanciate method), they
> typically set is_ref == 1. Like so:

>  

> object_init_ex(object, class_entry);

> object->refcount = 1;

> object->is_ref = 1;

>  

>  

> Why set the is_ref? Aren't objects treated as is_ref natively throughout the
> engine? Or is this just old code from PHP 4 days that is still hanging
> around?

>  

> Thanks for the understanding.

>  

> Bob Silva

>  




Best regards,
 Marcus
