# implicit_clone

- Thread: https://externals.io/message/2549
- Original archive: https://news-web.php.net/php.internals/2549
- Started by Sterling Hughes on 2003-06-22T17:59:24+00:00
- Messages: 4
- 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

---

## #2549 — Sterling Hughes — 2003-06-22T17:59:24+00:00

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

Hi,

Currently, soley for backwards compatibility purposes we provide the
ze2.implicit_clone option.  This option is globally settable, and may be
used by shared hosting providers to make it more likely that old scripts
can run unmodified.  This however makes it extremely hard, and inelegant
for people relying on new "functionality" in php5 to write portable php5
scripts.  More specifically, it would require every portable script to
do:

ini_set('ze2.implicit_clone', 0);

At the top of their script.  

I think we should remove this ini option in favor of a function that
does the same thing.  This way implicit_clone() is not globally
settable, but is settable per script.  Something in the way of a:

pragma_set('implicit_clone', true);

Which would turn on implicit_clone for the current script (current
portion of code.)

-Sterling

-- 
"A business that makes nothing but money is a poor kind of business." 
    - Henry Ford

---

## #2553 — Martin Jansen — 2003-06-22T18:23:16+00:00

URL: https://externals.io/message/2549#2553 · In reply to: #2549

> I think we should remove this ini option in favor of a function that
> does the same thing.  This way implicit_clone() is not globally
> settable, but is settable per script.  Something in the way of a:
> 
> pragma_set('implicit_clone', true);
> 
> Which would turn on implicit_clone for the current script (current
> portion of code.)

Sounds like a good idea for me, especially when taking into account that
pragma_set() can be called within a auto_prepend-file, which makes it
pretty easy to add "backwards compatibility" to a whole project without
much work.

-- 
    - Martin                           Martin Jansen
                            http://martinjansen.com/

---

## #2556 — Moriyoshi Koizumi — 2003-06-22T20:35:06+00:00

URL: https://externals.io/message/2549#2556 · In reply to: #2549

Sterling Hughes <sterling@bumblebury.com> wrote:

> I think we should remove this ini option in favor of a function that
> does the same thing.  This way implicit_clone() is not globally
> settable, but is settable per script.  Something in the way of a:
> 
> pragma_set('implicit_clone', true);
> 
> Which would turn on implicit_clone for the current script (current
> portion of code.)
> 

How about using "declare" statement?

Moriyoshi

---

## #2616 — Zeev Suraski — 2003-06-23T15:44:43+00:00

URL: https://externals.io/message/2549#2616 · In reply to: #2549

At 20:59 22/06/2003, Sterling Hughes wrote:
>hi,
>
>currently, soley for backwards compatibility purposes we provide the
>ze2.implicit_clone option.  this option is globally settable, and may be
>used by shared hosting providers to make it more likely that old scripts
>can run unmodified.  this however makes it extremely hard, and inelegant
>for people relying on new "functionality" in php5 to write portable php5
>scripts.  more specifically, it would require every portable script to
>do:
>
>ini_set('ze2.implicit_clone', 0);
>
>at the top of their script.
>
>i think we should remove this ini option in favor of a function that
>does the same thing.  this way implicit_clone() is not globally
>settable, but is settable per script.  something in the way of a:
>
>pragma_set('implicit_clone', true);
>
>which would turn on implicit_clone for the current script (current
>portion of code.)

A few notes:

First, either way we don't need a new function - if we wanted to do it, we 
could simply prevent users from using it except for with `ini_set()` (tag it 
with ZEND_INI_USER only).

Second, I think that the advantages and disadvantages here are about the 
same, without there being a perfect solution.  If we don't allow people to 
set it globally, upgrading becomes much more annoying.  On the other hand, 
if we do - new PHP 5 scripts will have to explicitly turn this 
compatibility mode off if they want to be absolutely certain that it's not 
there.  My personal opinion leans towards allowing people to set it on a 
global scale, so that it makes upgrading much simpler - I wouldn't want to 
force people to start hacking all of their files before they can even test 
whether PHP 5 works for them.

Maybe we can go for a compromise - enable it with ZEND_INI_PERDIR and 
ZEND_INI_UUSE.  That way it will be possible to use it with httpd.conf / 
.htaccess / `ini_set()`, but not with php.ini, so people will at least have 
to make a slightly more informed decision to enable it.  Just a suggestion, 
I'm not sure I like it myself :)

Zeev
