Monthly Archives: July 2009

PHP 5.3 BBQ Release Party Munich

We like to invite you to the PHP 5.3 release party which is an event to
celebrate the 5.3 release, happening Friday, the 17th of July in Munich.
The release party offers a chance to come together with other php
enthusiasts and enjoy that php is alive and kicking. And of course people
in favour of a decent barbecue, together with some beer and other drinks
are invited.

The happening will take place at Waldwirtschaft (http://www.waldwirtschaft.de)
beer garden, at any weather. We will meet at 19:00 o’clock – open end.

Catering will be provided and as a special delicacy you may enjoy a suckling pig!…hopefully vegetarian food. If you like to join the event please register at PHPUG-Munich Wiki (http://phpugmunich.org/dokuwiki/php_release_party) and follow it for updates. Alternatively you may register at Facebook
(http://www.facebook.com/event.php?eid=115203467104) as well and follow
this for updates.

For any questions please visit IRC channel: #phprp on irc.uni-erlangen.de.

The PHP 5.3. BBQ release party is sponsored by:
– Microsoft
– Mayflower GmbH
– Swoodoo AG
– Zend Technologies GmbH

Supporters for the PHP 5.3 BBQ release party are:
– Sun Microsystems
- PHPUG.de

Calling Conventions – when you need to know C to understand PHP

I think most of the people using PHP wonder from time to time about particular behavior of the language. That’s pretty much the same case with every language. Pythoneers have their wtf moments, Ruby programmers have their wtf moments and C programmers tend to live in a whole wtf universe. But lately I stumbled over a nice one. It looked like a bug in PHP, but turns out to be an interesting, curious, part of the C-language. Imagine the following PHP code sample and note that $a and $b are not defined (yeah I know, it’s bad coding style..blabla..):

<?php
var_dump($a + $b);
?>

What is the expected result with error_reporting set to E_ALL?

PHP Notice: Undefined variable: b in /var/foo/bla on line 1
PHP Notice: Undefined variable: a in /var/foo/bla on line 1
.
Are you sure? I’m not. On x86 hardware b is fetched before a is fetched and therefore the executor detects that b is not set first. But wait. Let’s test this on a SPARC machine:

PHP Notice: Undefined variable: a in /var/foo/bla on line 1
PHP Notice: Undefined variable: b in /var/foo/bla on line 1
.
What? It evaluates it in the reversed oder? What is happening? So I spend a few minutes with my lovely debugger and it turns out that this is what happens in the engine (I use pseudo code here):

result ZEND_ADD_OPCODE()
{
   return add_function(get_op1(), get_op2());
}

Voila, that’s the problem. On SPARC get_op1() is executed before get_op2(), while it’s the other way round on x86. As get_opX() detects if a variable exists, the error messages appear in reversed oder. I did a little bit research (thank you SunCC Team for your answer!) and it turned out, that C99 doesn’t define the way function calls in parameter lists are executed. Therefore, every system and compiler is free to use it’s own ordering mechanism. My current plan: Write a compiler that does this by random(). The fix is trivial:

result ZEND_ADD_OPCODE()
{
  op2 = get_op2();
  return add_function(get_op1(), op2);
}

. It’s a lovely curiosity.

git2svn, a little bit of git voodoo.

Interacting between git and subversion is quite common. The git command git-svn can be used to import existing subversion repositories into git and commit synchronize commits between two repositories. While importing a subversion repository into git is common, importing an git repository into subversion is quite unusual. There are various tools to do so, but most of them require direct access to the svn repository. In fact it is possible to use git-svn to get that job done. Frankly it requires some git voodoo and knowledge of the graft-feature. We’ll do a sample import using grafts, but before we start, we’ll explain the theory behind the import.
Continue reading