ID:               38745
 Updated by:       [EMAIL PROTECTED]
 Reported By:      arqentus at arqentus dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows 2003
 PHP Version:      5.1.6
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------

[2006-09-07 22:53:27] arqentus at arqentus dot com

Odd, using your example its returning 'xxx'; Grumbles, and i already
changed my code. I'll look into it tomorrow ( almost 01:00 here ). Its
very odd to say the least.

------------------------------------------------------------------------

[2006-09-07 22:27:57] [EMAIL PROTECTED]

>Yet, its perfectly able to override the class's variables
> IF its not extended.

What are you talking about?

<?php
class cText {
    var $desc = 'xxx';

    function __construct( $fields = array() ) {
        extract($fields, EXTR_REFS);
    }

}

$user_name = new cText( array ( "_desc" => 'Name' ) );
var_dump($user_name->desc);

?>
What do you get? "Name"? Or "xxx"?

------------------------------------------------------------------------

[2006-09-07 22:20:19] arqentus at arqentus dot com

"extract() creates variables in the current scope, it doesn't create
objects' attributes and was never meant to do it."

Yet, its perfectly able to override the class's variables IF its not
extended. In other words, while as you say, its not designed to work
for classes, it does actually work ( if used only in a baseclass ).

So, you are right, its not a complete bug, its a incomplete "feature"
thats lacking the ability to see past its current scope with a extended
class.

Note: See several examples on the general mailing list where people use
the same methode.

The extract function will need a update to it scope range. Using a
foreach loop is a rather inefficient way of handeling it compared to a
extract.

------------------------------------------------------------------------

[2006-09-07 22:09:28] [EMAIL PROTECTED]

Actually it has nothing to do with EXTR_.
extract() creates variables in the current scope, it doesn't create
objects' attributes and was never meant to do it.

------------------------------------------------------------------------

[2006-09-07 22:05:26] arqentus at arqentus dot com

Note: The extract code was texted with EXTR_OVERWRITE & EXTR_IF_EXISTS.
The "EXTR_REFS" was a final foolish attempt to see how it was going to
react( expecting a error feedback, but nothing came ). Forgot to remove
it from the submitted code.

I'm including this comment, to be sure this bug does not get closed
becouse you think i used the wrong EXTR ;)

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/38745

-- 
Edit this bug report at http://bugs.php.net/?id=38745&edit=1

Reply via email to