Yii Framework Forum: I Wasted 12 Hours - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I Wasted 12 Hours Rate Topic: -----

#1 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 17 March 2013 - 08:46 AM

I wasted 12 hours debugging this ...
$total = 0;
foreach($model->rels as $rel);
{
    $total += $rel->count;
}
echo $total; // wrong result!!


Who in the hell wrote that wicked semicolon? Me?
In the real source, the relation was a little bit complicated, and I wasted time examining it.
0

#2 User is offline   Reza m 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 148
  • Joined: 07-March 12

Posted 17 March 2013 - 09:13 AM

It happens sometimes, especially when it's time to sleep ;)
1

#3 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 17 March 2013 - 09:15 AM

Exactly. :D
Going to bed was the right solution to me.
1

#4 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 492
  • Joined: 08-August 09

Posted 18 March 2013 - 06:38 AM

Yeaah, such typos are the most difficult ones to fix.
Thanks for showing it, might probably save 12 hrs to someone else :)
0

#5 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,688
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 18 March 2013 - 07:05 AM

That's why Gods created 1TBS.
God is real unless declared as integer
2

#6 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 18 March 2013 - 07:43 AM

View PostORey, on 18 March 2013 - 07:05 AM, said:

That's why Gods created 1TBS.

Yeah, I have to confess that I regretted a bit of my coding style preference.

BTW, is there any clever IDE to warn this kind of possible mistake?
0

#7 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,308
  • Joined: 17-January 09
  • Location:Russia

Posted 18 March 2013 - 08:05 AM

Code is valid so I doubt any IDE will complain. Yii2 code style will be better in this regard.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#8 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 31 March 2013 - 09:53 AM

So, I finally changed my IDE from NetBeans to PhpStorm.

Attached File  phpstorm.png (3.45K)
Number of downloads: 32

It underscores $rel and says "Variable 'rel' might have not been defined."
PhpStorm reads the code ... You feel like you are doing the "pair programming" with someone who is clever enough.
0

#9 User is offline   Bjorn 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 155
  • Joined: 15-April 13
  • Location:The Netherlands

Posted 15 April 2013 - 01:36 AM

Haha so recognizable, I allmost killed my computer for a semicolon like that :).
Thanks for the tip about PHPStorm, gonne take a look into that. I'm using Aptana and it won't give me heads up about this either.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users