[drupal-devel] I do not care about PHP 5

Larry Garfield larry at garfieldtech.com
Sun Oct 16 21:41:31 UTC 2005


On Sunday 16 October 2005 04:23 pm, Bèr Kessels wrote:
> On Sun, Oct 16, 2005 at 03:20:02PM -0500, Larry Garfield wrote:
> > I agree, generally, but fix to what?  We should decide whether we're
> > going to standardize on is_null() or === NULL before we start writing
> > patches to always use one or the other, for instance.
>
> That is why i proposed to write the standards first.
> Off course we cannot yet agree on the details, untill they are tested in
> patches. But the general decisions should be made before we start
> patching with again a variety of solutions.
>
> Ber

Well, let's sort out what sorts of errors we're dealing with under E_STRICT, 
and then see what the options are.  In general I'd suggest going with the 
most pretty-code-friendly solution in most cases, unless there's a dramatic 
speed difference.  

- I don't believe there's any classes in Drupal, so var vs. public/private is 
a non-issue.

- Checking for variable existence.  isset() is the standard way I know of, 
baring just always initializing a variable.  The latter is not always 
possible, though.  Does PHP have a cleaner default value syntax than the 
ternary operator?  It works, but it's ugly. :-)  (Python, I believe, can do   
x = y || z to use z as a default value if y is not set.  I don't know if PHP 
has an equivalent.)

- NULL values.  Where would these be an issue other than pulling data from the 
database?  I'm of the mind that given MySQL's poor handling of null vs. 
default values, we should just always specify NOT NULL and a default for 
every field, period.  That default value is then understood to be the "no 
value" flag.  

Other thoughts?

-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson



More information about the drupal-devel mailing list