Wednesday, February 13, 2008
Whether to INI or not
So I've had enough of different PHP versions compiled in different modes (ZTS or DEGBUG) and having to change the php.ini file every now and then on my dev machines. So I added conditional INI support:
I used square brackets for the conditionals, as it seemed the way that comes with the least potential for INI handling. This is because right now we ignore section names anyway.
The patch can be downloaded here and allows for the following:
[IF (ZEND_DEBUG_BUILD == true) && (ZEND_THREAD_SAFE == true)]
zend_extension_debug_ts=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSEIF ZEND_DEBUG_BUILD == true]
zend_extension_debug=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSEIF ZEND_THREAD_SAFE == true]
zend_extension_ts=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSE]
zend_extension=/usr/src/${PHP_BRANCH}/modules/xdebug.so
[ENDIF]
zend_extension_debug_ts=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSEIF ZEND_DEBUG_BUILD == true]
zend_extension_debug=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSEIF ZEND_THREAD_SAFE == true]
zend_extension_ts=/usr/src/${PHP_BRANCH}/xdebug.so
[ELSE]
zend_extension=/usr/src/${PHP_BRANCH}/modules/xdebug.so
[ENDIF]
I used square brackets for the conditionals, as it seemed the way that comes with the least potential for INI handling. This is because right now we ignore section names anyway.
The patch can be downloaded here and allows for the following:
- String comparison using operators === and !==.
- All other operators convert left and right operands to integers first, just as INI handling would do for value evaluation.
- Support for operators <, <=, >, >=, ==, !=, && and ||.
- Braces can be used to force an evaluation order.
- No support for unary operator ! or ternary operator ?:.
- No support for functions.
- No direct boolean evaluation, that is operators are required.
- Conditions can be nested.
Blogged with Flock
Labels: PHP
Subscribe to Posts [Atom]