PHP and passing non-variables by reference

In PHP 5.0.5, they’ve now made it a requirement that things that are passed by reference must now explicitly be a variable. You would think this kind of behavior is obvious, but apparently it’s been allowed for all versions of PHP previous. Appararently without even warnings. You’ll get an error:

Fatal error: Only variables can be passed by reference ...

So you may think, where is this useful? Consider something short and concise like:

$only_element_we_care_about = array_pop(explode($seperator, $string));

You cannot do this now. The return value of a function is not a “variable” and cannot be passed by reference; a temporary variable needs to be used instead:

$tempory_variable = explode($seperator, $string); $only_element_we_care_about = array_pop($temporary_variable);

Yes, there are other ways to do the above, but that isn’t the point. The fix is not difficult, but it is a total complete pain to go back to legacy code and fix things like this.

Remind me to find another web programming language.

New TV show: Rome

HBO has a new TV show: Rome. It’s about… Rome. Particularly, the fall of the Roman Republic and the rise of the Roman empire. Episode 2 aired this week, and I’m so far liking how they’re not improvising Roman history to make for good TV. Well, OK, they are.

It’s typical HBO. There’s totally uncensored sex. Not enough violence in my opinion (so far anyway). And totally superb acting. The show keeps historical context, at least as well as I know it, as a clear focus.

Though, it’s only the end of episode 2, and Caesar is already marching on Rome. This looks like it’s going to be a short series…

Working on a new Drupal theme...

I am getting tired of the Drupal theme selection currently available. The move to PHPTemplate (as well as the the Drupal Themegarden outage) has left few good templates.

Bluemarine… I don’t know. I hate the way it’s low contrast.

I’ve disabled my site’s usual theme and am developing the new one, based off of Bluemarine for PHPTemplate from CVS.

Things I am focusing on:

  • Making certain elements look nicer and more modern, for example: comments, node information, etc
  • Correctly used relative font sizes (my MAJOR peeve with many themes: I know how to configure my web browser, I want 1em fonts for content text)
  • Revamp colors such that text is high-contrast with muted background colors
  • Separate in CSS page layout from things meant to be customized, like colors, link styles, etc
  • Underlined links with discernable link colors

If you’ve any comments on how things should look, please let me know.


Subscribe to Samat Says RSS