Re: Object to array conversion oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 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 tin. By its very nature, casting from object to array indicates  
> that you no longer want the constraints of property protection, which  
> an array can't preserve anyway, and it's not as if there are not  
> intentional, documented methods of obtaining this information.
> 
> > It sounds like they've helped out by giving more data than was
> > necessary.
> 
> ...and in doing so defaults to breaking code that expects it to  
> behave like the documentation says it does? I don't think I'd  
> classify that as helping out. Bear in mind that my code broke in  
> exactly this way. If you want to find out what the access level of a  
> property is, I doubt your first thought would be to convert it to an  
> array - and I bet you didn't know that this info was even there  
> because it's not documented, thus helping nobody. This is what  
> introspection is for. I don't have a problem with being provided with  
> extra information, just as long as it doesn't interfere with correct  
> operation, which is what it currently does. It could provide the  
> extra info in a marginally less destructive way, for example by  
> adding 'private' and 'protected' array properties containing field  
> names for each access level to the resulting array. OTOH, that would  
> break what you'd expect count() to deliver after the conversion. I  
> really think it should just do what's it's meant to, and no more.

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*

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux