You are here: Re: [PHP] Assistance debugging php 5.x.x « PHP « IT news, forums, messages
Re: [PHP] Assistance debugging php 5.x.x

Posted by Jochem Maas on 11/23/05 21:21

eric van blokland wrote:
> LOL @ Jochem
>
> Well I sure can't argue with that! (serious)
>
> But with or without comments, the code is broken or breaks
> something. I've tracked down the weird bevahiour a little further. Now I
> would sure like, if one of you has about 30 minutes time to look at my
> problem with me, using VNC and Skype
> If you got the spare time I would really appreciate it and as I've been
> unable to create some actual reproduce code, the only thing that's left
> is looking at the real thing. I'm still sure it's related to the way I
> use references, wheter it is or isn't a bug in the compiler, it sure
> would be nice to know this particular DON'T about references.
>
> Please let me know

1. it could be considered over-engineered
2. you seem to be reinventing the wheel (templating?)
3. you are lacking knowledge regarding php5 OO
(for starters why are not you using __construct() for the ctors?)
4. YOU ARE USING REFERENCES ALL OVER THE PLACE!!! ;-)

regarding no. 4, some examples:

function fs_handle_object_properties(&$object) {
// ^--- destroy it


// why bother sticking the object in a 'serialize container'?
// and where was the class defined in the example code???
function fs_serialize(&$object) {
// ^--- destroy it
$container=new fs_serialize_container();

$container->object=&$object;
// ^--- destroy it
return serialize($container);
}


// what happens in this code when $name
// is 'properties' or some other value that
// is the name of pre-defined object attribute?
function fs_handle_object_properties(&$object) {
global $stdo;
$changed=false;
if(isset($object->properties) && is_array($object->properties)) {
foreach($object->properties as $name=> $property) {
if(isset($property->changed) && $property->changed==true){
$object->changed=true;
$changed=true;
$object->$name=$property->value;
}
}


// if you are already using $_SESSION why complicate matters
// by also storing duplicate stuff in $_COOKIE? _seems_ a
// waste of time.
function fs_process_properties() {
if(isset($_COOKIE['fs_properties'])) {
$properties=explode(';',$_COOKIE['fs_properties']);


function &fs_unserialize($string) {
// ^-- destroy it


class std_page {

/* ... */
function edit(&$structure) {
// ^-- ???
global $stdo;
foreach($this->properties as $key=>&$property) {
// ^-- $property is an object !!!!
print $property->parse();
}


and so on. getting rid of all the referencing of objects will most
probably get rid of your problems - I'll pass on the argument
as to whether it should work as it is.

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

you might also want to read up on __call(), __set()
and __get(). oh and there are the functions is_array(),
is_object() and the keyword 'instanceof' which you
might want to consider making more use of in order to
check your variables.


>
> On 11/23/05, *Jochem Maas* <jochem@iamjochem.com
> <mailto:jochem@iamjochem.com>> wrote:
>
> Eric,
>
> everything you have written suggests to me that the problem is in
> your code
> (that may be being caused by changes to the engine, which have
> either removed
> an ability due to the fact that it was dangerous [e.g. reference
> issues], or
> abilities that have been changed because they were deemed wrong)
>
> regardless of whether that is the case or not you are best off by
> assuming that
> the problem is in your code:
>
> 1. if its your code you have the power to fix it, which is a better
> situation
> to be in than have to rely on third parties to fix an underlying
> texchnology.
>
> 2. it avoids 'blaming' core developers until such time as you can
> _prove_ the
> engine has a bug.
>
> eric van blokland wrote:
> > 1. That's what I've warned about from the beginning, that outside the
> > complete project environment the error probably wouldn't occur.
> > 2. I understand this completely, naturally. I would like to thank
> everybody
> > spending time in reading my posts, particulary you, Jay. But
> that's why I
> > would like to give you, or anyone else for that matter, an
> attended tour
> > through the project.
> > 3. I'm beeing pushed to present results, writting comments in my
> code would
> > take almost twice the time writing the code itself. And in most
> cases, it's
> > faster just to read my code instead of reading the comment. And
> finally, you
>
> the last 3 lines are bullshit on all counts (apart from the implied
> deadline
> pressure), do yourself a favor and starting commenting! :-)
>
> > wouldn't be able to read my comments, as my comments would be in
> dutch.
>
> I'd be happy to translate for you Jay ;-)
>
> having said that there is no reason to write comments in dutch if your
> english is as good as it is, but comments in any language are always
> better than
> none. (assuming the comments actually have some baring on the actual
> code -
> i.e. comments like '// Bill Gates has lots of money' don't really
> help!)
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация