For Programmers: Free Programming Magazines  


Home > Archive > PHP PEAR Questions and Answers > October 2005 > Re: [PEAR-QA] Re: XML_CSSML, XML_XPath









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR-QA] Re: XML_CSSML, XML_XPath
Arnaud Limbourg

2005-10-10, 3:56 am

> I didn't tho fix the issue of wrong installation path, which is a
> potential BC issue.
>
> See: http://pear.php.net/bugs/bug.php?id=5574
>
> QA needs to come to some conclusion what should be done.


The install path is correct (I updated the bug with this comment).

An issue though is related to PHP 5. I run 5.1.0-RC1 which throws a
fatal error because this package uses $this reassignement trick.

I can add a dep so the package cannot be installed under PHP5. People
installing the current release under PHP5 are in for trouble. It has
been downloaded > 21,000 times so far.

I don't see any other way out, except if we put a big warning telling
people need to update their scripts to use the factory method. That
would break BC though.

Arnaud.
Arnaud Limbourg

2005-10-10, 3:56 am

To be clearer it boils down to two choices:

- add a dependency on PHP4, so it cannot be installed under PHP5
- add a warning telling people to update their script to use the factory
method and remove the $this reassignment trick
bertrand Gugger

2005-10-10, 7:56 am

Bonjour,
Arnaud Limbourg wrote:

>To be clearer it boils down to two choices:
>
>- add a dependency on PHP4, so it cannot be installed under PHP5
>- add a warning telling people to update their script to use the factory
>method and remove the $this reassignment trick
>
>
>

I still believe it's possible to correct this bug for any PHP
The trick could be done by adding a private property:
$_theObj = null;
if the constructor is called instead of the factory do:
$this->_theObj = $this->factory($in_driver, $in_CSSML,
$in_type, $in_params);
then correct all the methods in CSSML.php as:
function load()
{
if ($this->_theObj) {
return $this->_theObj->load();
}
if ($this->loaded) {
return PEAR::raiseError(null, XML_CSSML_ALREADY_EXISTS,
null, E_USER_WARNING, $this->CSSMLDoc, 'XML_CSSML_Error', true);
}
}
etc...
my 2cts
ą+
--
bertrand "toggg" Gugger
bertrand Gugger

2005-10-10, 7:56 am

Auto reply after an IRC discussion:
bertrand Gugger wrote:

> Bonjour,
> Arnaud Limbourg wrote:
>
> I still believe it's possible to correct this bug for any PHP
> The trick could be done by adding a private property:
> $_theObj = null;
> if the constructor is called instead of the factory do:
> $this->_theObj = $this->factory($in_driver, $in_CSSML,
> $in_type, $in_params);
> then correct all the methods in CSSML.php as:
> function load()
> {
> if ($this->_theObj) {
> return $this->_theObj->load();
> }
> if ($this->loaded) {
> return PEAR::raiseError(null, XML_CSSML_ALREADY_EXISTS,
> null, E_USER_WARNING, $this->CSSMLDoc, 'XML_CSSML_Error', true);
> }
> }
> etc...
> my 2cts
> ą+


Constructor should be (missed the &)
$this->_theObj = & $this->factory($in_driver, $in_CSSML, $in_type,
$in_params);
Also the properties to reassign in this case:
$this->loaded = &$this->_theObj->loaded;
.... etc.
This methods and properties "reassignments" should be done for all
methods/properties inclusive what the drivers create.
On this way, 100% BC is guaranted for the standard package.
People customizing the drivers will have to use the "factory"

This adaptation only takes place for users of the constructor, will make
no difference (1 extra if () ) for the right "factory" users.

If the cops here agree, I can do it, test it and commit it so the
QA-team can release it.
ą+
--
bertrand "toggg" Gugger
Helgi Žormar

2005-10-10, 6:57 pm

On Mon, 10 Oct 2005 13:09:00 +0200, bertrand Gugger wrote:
>
> If the cops here agree, I can do it, test it and commit it so the
> QA-team can release it.
> ą+


Yeah, just go ahead and do it, tho I think it's kinda of a extra work just
to support a obviously wrong way :P (assignment to this that is)

- Helgi
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com