On 26 Sep 2006, at 23:52, Richard Lynch wrote:
You start using that PHP5 private/protected stuff, and it just doesn't
make sense to coerce it to an array, imho.
I'm quite aware of that, and in this case I'm using it in a one-off
string-and-glue fix for a specific problem until I fix it prope
On Sat, September 23, 2006 10:39 am, Marcus Bointon wrote:
> On 23 Sep 2006, at 16:37, Ray Hauge wrote:
>
>> Could you do something like this?
>>
>> $private = "Myclass"
>> $protected = "*";
>
> No, because if I have a property called 'Myclassfield1', after
> casting to an array I can't tell if it'
On Sun, 2006-09-24 at 22:26 +0100, Marcus Bointon wrote:
> On 24 Sep 2006, at 22:07, Ray Hauge wrote:
>
> > Maybe you missed it, but he did submit a bug report:
> >
> > http://bugs.php.net/?id=38935
> >
> > He just wanted to see if other people had run into a similar
> > situation before
> > sub
On 24 Sep 2006, at 22:07, Ray Hauge wrote:
Maybe you missed it, but he did submit a bug report:
http://bugs.php.net/?id=38935
He just wanted to see if other people had run into a similar
situation before
submitting the bug... from my understanding. I don't want to put
words in
Marcus' mo
On Sunday 24 September 2006 15:00, Robert Cummings wrote:
> Because you're pointing it out to the wrong people. See bugs.php.net.
Maybe you missed it, but he did submit a bug report:
http://bugs.php.net/?id=38935
He just wanted to see if other people had run into a similar situation before
subm
On Sun, 2006-09-24 at 10:53 +0100, Marcus Bointon wrote:
> On 24 Sep 2006, at 01:05, Robert Cummings wrote:
>
> > Blah, blah, blah. The documentation is probably out of date and
> > applied
> > to PHP4. Feel free to get off your arse and volunteer if you don't
> > like
> > it >:) You don't get
On 24 Sep 2006, at 01:09, Robert Cummings wrote:
It's broken, it doesn't preserve references.
B = $a;
var_dump(object2array($b));
?>
array(3) {
["A"]=>
NULL
["B"]=>
object(B)#1 (4) {
["A:private"]=>
NULL
["B"]=>
NULL
["c:protected"]=>
NULL
["A:private"]=>
On 24 Sep 2006, at 01:05, Robert Cummings wrote:
Blah, blah, blah. The documentation is probably out of date and
applied
to PHP4. Feel free to get off your arse and volunteer if you don't
like
it >:) You don't get have your cake and eat it *PTHTHTHTHTTHTHTH*
How exactly am I not helping by
On Sat, 2006-09-23 at 22:35 +0100, Marcus Bointon wrote:
> I've written a function that does a conversion that matches the docs,
> based on the other info I've mentioned:
>
> /**
> * Clean up the name munging that PHP applies while casting from
> object to array
> * The resulting array looks l
On Sat, 2006-09-23 at 17:41 +0100, Marcus Bointon wrote:
> On 23 Sep 2006, at 16:46, Robert Cummings wrote:
>
> > And the likelihood of you having a property called Myclassfield1 is?
>
> Sure, but don't you think that coding should at least try to be
> driven by logic rather than luck? I'm also
I've written a function that does a conversion that matches the docs,
based on the other info I've mentioned:
/**
* Clean up the name munging that PHP applies while casting from
object to array
* The resulting array looks like what the documentation says that
(array)$object delivers, but ac
On 23 Sep 2006, at 18:54, Jon Anderson wrote:
If you just want an array of properties, add this to your class...
That's exactly the kind of thing I was on about. Since reflection
gives access to all this information, why bother trying to squeeze
the same info into an array-shaped containe
Marcus Bointon wrote:
Sure, but don't you think that coding should at least try to be driven
by logic rather than luck? I'm also not denying that it's not too hard
to work around (with a function not dissimilar to what you suggested),
but I'd really prefer it if it just did what it says on the
On Saturday 23 September 2006 11:41, Marcus Bointon wrote:
> On 23 Sep 2006, at 16:46, Robert Cummings wrote:
> > And the likelihood of you having a property called Myclassfield1 is?
>
> Sure, but don't you think that coding should at least try to be
> driven by logic rather than luck? I'm also not
On 23 Sep 2006, at 16:46, Robert Cummings wrote:
And the likelihood of you having a property called Myclassfield1 is?
Sure, but don't you think that coding should at least try to be
driven by logic rather than luck? I'm also not denying that it's not
too hard to work around (with a functio
On Sat, 2006-09-23 at 11:46 -0400, Robert Cummings wrote:
> On Sat, 2006-09-23 at 16:04 +0100, Marcus Bointon wrote:
> > On 23 Sep 2006, at 15:51, Ray Hauge wrote:
> >
> > > To me it looks like they append the name of the class to any private
> > > variables. I would guess that it does this to ma
On Sat, 2006-09-23 at 16:04 +0100, Marcus Bointon wrote:
> On 23 Sep 2006, at 15:51, Ray Hauge wrote:
>
> > To me it looks like they append the name of the class to any private
> > variables. I would guess that it does this to make sure you know
> > what you're
> > doing and using the private v
On 23 Sep 2006, at 16:37, Ray Hauge wrote:
Could you do something like this?
$private = "Myclass"
$protected = "*";
No, because if I have a property called 'Myclassfield1', after
casting to an array I can't tell if it's private property called
'field1' or a public property called 'Myclass
On Saturday 23 September 2006 10:04, Marcus Bointon wrote:
> On 23 Sep 2006, at 15:51, Ray Hauge wrote:
> > To me it looks like they append the name of the class to any private
> > variables. I would guess that it does this to make sure you know
> > what you're
> > doing and using the private vari
Here's a more accurate example:
This produces:
object(Myclass)#1 (3) {
["field1"]=>
string(0) ""
["field2:private"]=>
string(0) ""
["field3:protected"]=>
string(0) ""
}
array(3) {
["field1"]=>
string(0) ""
["Myclassfield2"]=>
string(0) ""
["*field3"]=>
string(0) ""
}
S
On 23 Sep 2006, at 15:51, Ray Hauge wrote:
To me it looks like they append the name of the class to any private
variables. I would guess that it does this to make sure you know
what you're
doing and using the private variable like that. I'm just guessing
at that
point though.
Well, I r
On Saturday 23 September 2006 09:40, Marcus Bointon wrote:
> A simple class like this:
>
> class Myclass() {
> public $field1 = '';
> private $field2 = '';
> public function __sleep() {
>return array('field1', 'field2');
> }
> }
> $myclass = new Myclass;
>
> If I var_dump this, I get:
>
> objec
22 matches
Mail list logo