Open Source Content Management Framework

Re: [midgard-dev] MidCOM svn: r25325 - in branches/ragnaroek/midcom: fi.protie.checkout midcom.core/midcom midcom.core/midcom/baseclasses/components midcom.core/midcom/services midcom.helper.datamanager midcom.helper.search/sty...

  1. Re: [midgard-dev] MidCOM svn: r25325 - in branches/ragnaroek/midcom: fi.protie.checkout midcom.core/midcom midcom.core/midcom/baseclasses/components midcom.core/midcom/services midcom.helper.datamanager midcom.helper.search/sty...

    Thu March 18 2010 18:25:08 UTC
    Hi!

    I'm a bit confused about some of these changes:

    > Modified: branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php
    > ==============================================================================
    > --- branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php (original)
    > +++ branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php Thu Mar 18 17:52:27 2010
    > @@ -155,7 +155,7 @@
    > function initialize(&$master)
    > {
    > $this->_master =& $master;
    > - $this->_i18n =& $_MIDCOM->i18n;
    > + $this->_i18n = $_MIDCOM->i18n;
    > $this->_l10n_midcom =& $master->_l10n_midcom;
    >

    I haven't really looked at PHP 5.3 yet, but is the above really
    deprecated, i.e. shouldn't we use references at all any more?



    Also with the following change, do the return values still behave like
    proper references in older PHP versions?


    > Modified: branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php
    > ==============================================================================
    > --- branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php (original)
    > +++ branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php Thu Mar 18 17:52:27 2010
    > @@ -203,7 +203,7 @@
    > * @param int $context_id The context to retrieve the node toolbar for, this
    > * defaults to the current context.
    > */
    > - function& get_host_toolbar ($context_id = null)
    > + function get_host_toolbar ($context_id = null)
    > {
    > if ($context_id === null)
    > {
    > @@ -225,7 +225,7 @@
    > * @param int $context_id The context to retrieve the node toolbar for, this
    > * defaults to the current context.
    > */
    > - function& get_node_toolbar ($context_id = null)
    > + function get_node_toolbar ($context_id = null)
    > {
    > if ($context_id === null)
    > {
    > @@ -247,7 +247,7 @@
    > * @param int $context_id The context to retrieve the view toolbar for, this
    > * defaults to the current context.
    > */
    > - function& get_view_toolbar ($context_id = null)
    > + function get_view_toolbar ($context_id = null)
    > {
    > if ($context_id === null)
    > {
    > @@ -269,7 +269,7 @@
    > * @param int $context_id The context to retrieve the help toolbar for, this
    > * defaults to the current context.
    > */
    > - function& get_help_toolbar ($context_id = null)
    > + function get_help_toolbar ($context_id = null)
    > {
    > if ($context_id === null)
    > {
    >

    Bye,

    Andreas

    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  2. Re: [midgard-dev] MidCOM svn: r25325 - in branches/ragnaroek/midcom: fi.protie.checkout midcom.core/midcom midcom.core/midcom/baseclasses/components midcom.core/midcom/services midcom.helper.datamanager midcom.helper.search/sty...

    Thu March 18 2010 18:40:08 UTC
    On 18.03.2010, at 21:20, Andreas Flack wrote:

    > Hi!
    >
    > I'm a bit confused about some of these changes:
    >
    >> Modified: branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php
    >> ==============================================================================
    >> --- branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php (original)
    >> +++ branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/components/handler.php Thu Mar 18 17:52:27 2010
    >> @@ -155,7 +155,7 @@
    >> function initialize(&$master)
    >> {
    >> $this->_master =& $master;
    >> - $this->_i18n =& $_MIDCOM->i18n;
    >> + $this->_i18n = $_MIDCOM->i18n;
    >> $this->_l10n_midcom =& $master->_l10n_midcom;
    >>
    >
    > I haven't really looked at PHP 5.3 yet, but is the above really deprecated, i.e. shouldn't we use references at all any more?
    >
    >
    >
    > Also with the following change, do the return values still behave like proper references in older PHP versions?

    It's not php-5.3 specific. It's php5-specific.
    In PHP4 you had to ALWAYS explicitly send objects by-reference (unless you wanted a separate copy, which is rare)

    In PHP5 objects are implicitly sent as "pseudo-references" and explicit references are not needed and even considered harmful.
    see http://docs.php.net/manual/en/language.oop5.references.php for details

    There are rare cases when explicit references are still needed. for example, if you need to reassign original object using reference:

    $a = new someClass();
    $b =& $a;

    $b = 2; // and you want change $a to 2 too at this point.


    >
    >
    >> Modified: branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php
    >> ==============================================================================
    >> --- branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php (original)
    >> +++ branches/ragnaroek/midcom/midcom.core/midcom/services/toolbars.php Thu Mar 18 17:52:27 2010
    >> @@ -203,7 +203,7 @@
    >> * @param int $context_id The context to retrieve the node toolbar for, this
    >> * defaults to the current context.
    >> */
    >> - function& get_host_toolbar ($context_id = null)
    >> + function get_host_toolbar ($context_id = null)
    >> {
    >> if ($context_id === null)
    >> {
    >> @@ -225,7 +225,7 @@
    >> * @param int $context_id The context to retrieve the node toolbar for, this
    >> * defaults to the current context.
    >> */
    >> - function& get_node_toolbar ($context_id = null)
    >> + function get_node_toolbar ($context_id = null)
    >> {
    >> if ($context_id === null)
    >> {
    >> @@ -247,7 +247,7 @@
    >> * @param int $context_id The context to retrieve the view toolbar for, this
    >> * defaults to the current context.
    >> */
    >> - function& get_view_toolbar ($context_id = null)
    >> + function get_view_toolbar ($context_id = null)
    >> {
    >> if ($context_id === null)
    >> {
    >> @@ -269,7 +269,7 @@
    >> * @param int $context_id The context to retrieve the help toolbar for, this
    >> * defaults to the current context.
    >> */
    >> - function& get_help_toolbar ($context_id = null)
    >> + function get_help_toolbar ($context_id = null)
    >> {
    >> if ($context_id === null)
    >> {
    >>
    >
    > Bye,
    >
    > Andreas
    > <flack.vcf>_______________________________________________
    > dev mailing list
    > dev@lists.midgard-project.org
    > http://lists.midgard-project.org/mailman/listinfo/dev

    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
Designed by Nemein, hosted by Kafit