Browsing articles in "PHP"
Aug
5

PHP5-CLI versus Python CLI

I just thought this was kind of interesting.   Out of the box CLI comparison of PHP and Python type errors :D

Python

>>> test = 123
>>> test2 = "ewfwef"
>>> test / test2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'int' and 'str'

PHP

$test = 123;
$test2 = "werwe";
echo $test/$test2;

Warning: Division by zero in Command line code on line 1

It’s nice that python tells you what is really wrong here, you can’t divide an integer by a string! PHP on the other hand implies that $test2 is equivalent to 0.
It should be noted that python is doing a trace and PHP is not. Doing a trace on the error in PHP would give more information but since PHP is very weak with types, you would probably have to notice the error on your own.

Mar
13

Contextual Navigation in Symfony

I am currently working on a project using symfony and got to a point where I wanted to add a contextual navigation menu. In other words, I wanted to have a menu that would show a list of pages, but not show the current page. After considering using slots, components, and component slots, I decided on a solution that I like. Read on to find out what it is. read more

Feb
9

Symfony sfModelGenerator.class.php line 321 error

By Tom Schultz  //  Blog Post, PHP  //  3 Comments

Well I’ve been playing with Symfony and I started building modules today from the Jobeet day 3 tutorial and I ran into an issue.   The Symfony Project is basically a framework in which you can build PHP web applications which I’ve been using for a school project.

I’m not sure if I missed a step of if this is a system specific problem but basically I went to run the “symfony propel:build-module” command to genereate my module files and I got this error.

Fatal error: Class ‘PersonForm’ not found in /var/www/cam/trunk/lib/generator/sfModelGenerator.class.php on line 321

read more

Feb
1

Development Environments vs. Production Environments

By Steve Oxley  //  PHP  //  1 Comment

I like the idea of having two separate environments for my website.  That way I do not have to worry about remembering to turn off the profiler (if I’m using a profiler) or making sure that I do not mess up the database while messing around with test data etcetera.  There is also no question that Symfony executes the Development/Test/Production environment philosophy very well.  However, there is also no question that, when one runs into a bug that only shows up in one environment and not in the other, it can be very difficult to squash, indeed.

read more