News

5.8.4RC2

at 2012-01-23 in 5.8-SERIESAnnouncementsReleases by friebe

We would like to announce the immediate availability of the second release candidate for XP 5.8.4. On top of the first RC, we have included fixes for the HTTP transport based on the curl extension and bugfixes for XMLRPC deserialization. We would like to thank the contributors from over at GamePay for these patches! Also, there have been several optimization to the XP compiler in generating dependencies.

You can download and install as always:

  $ cd ~/xp
$ wget http://releases.xp-framework.net/setup/5.8.4RC2 -O - | php -- -d ~/bin/

Enjoy:-)



RFC #0231: Remove xp.contrib's "dba" module

at 2012-01-22 in 5.8-SERIES5.9-SERIESRFCs by friebe

Scope of Change
The module "dba" will be completely removed.

Rationale
The io.dba classes where deprecated in the 5.8-SERIES and moved to the ports repository (what is now "xp.contrib") for backwards compatibility on 2010-02-14, almost two years ago at the time of writing.

Read the full RFC here



RFC #0184: Drop SAPI feature alltogether

at 2012-01-21 in 5.9-SERIESRFCs by friebe

Rationale
The sapi feature was initially introduced to offer a way to extend the XP framework's core code, provided by lang.base.php, in a manner similar to that file, eg. without having to encapsulate that code in a class.

Now, we think code should always be loaded as a class, which bring several features like having an associated classloader.

Functionality
Functionality provided by one of the XP framework's sapi files will be migrated to be provided by regular classes, preferrably backwards compatible.

Read the full RFC here



5.8.4RC1

at 2012-01-12 in AnnouncementsReleases by friebe

We would like to announce the immediate availability of the first release candidate for XP 5.8.4. This release contains various fixes and enhancements like SQLite3 support in the rdbms package, as well as the extended server protocol, the first release of our mocking library, a REST client and support for combining application properties from varios sources.

You can download and install as always:

  $ cd ~/xp
$ wget http://releases.xp-framework.net/setup/5.8.4RC1 -O - | php -- -d ~/bin/

Enjoy:-)



Heads up: Using local sockets to connect to MySQL

at 2012-01-08 in AnnouncementsDatabases by friebe

MySQL logoMySQL allows running MySQL servers with disabled networking. This is suggested as security measure if the application and the database server run on the same machine, but in reality we usually don't have this kind of a setup except on the developers' machines. This is where we hit an inconsistency in our userland MySQL driver "mysqlx": It wasn't connecting to the MySQL server on localhost, where the standard MySQL driver was. This has been fixed in the meantime.

Some research into this topic revealed the following:

  • MySQL uses an AF_UNIX socket on Un*x systems. By default, this is in /tmp/mysql.sock
  • On Windows, a named pipe serves the same purpose. It's usually called \\.\pipe\MySQL
  • The MySQL libraries will connect via these local sockets if "localhost" is supplied as host name

Especially the last part is a bit frustrating, because it's magic, and magic behaviour is never good in software. This is why the XP group has decided to be inconsistent with the MySQL libraries and not support this in mysqlx. Furthermore, we have decided to remove the magic from the standard MySQL driver implementations in order to be consistent. Instead, use the dot (.) as a notation for "this machine", as seen in the following examples:

  // Connect to the MySQL server on this machine via local sockets.
// Determine socket by using OS-dependant lookup mechanisms.
$conn= DriverManager::getConnection('mysql://./NEWS');

// Supply local socket's name
$conn= DriverManager::getConnection('mysql://./NEWS?socket=/tmp/mysql.sock');
$conn= DriverManager::getConnection('mysql://./NEWS?socket=\\\\.\\pipe\\mysql');
In contrast, this will now always use TCP/IP:

  $conn= DriverManager::getConnection('mysql://localhost/NEWS');



PHP Namespaces and the XP Framework

at 2012-01-06 in RFCsPHP5Examples5.9-SERIES by friebe

With the implementation of RFC #0222, we have added optional PHP namespaces support to the XP Framework. Optional means the XP Framework itself will neither depend on PHP 5.3 (still supporting PHP 5.2.10 upward at least for the 5.9-SERIES) nor will it change any of its classes to use them. That doesn't mean you can't use them, though:-)

Here's a quick-start guide:

  • PHP namespaces use the backslash (\). These translate 1:1 to the package separator in the XP Framework, the dot (.).
  • Classes with PHP namespaces, fully-qualified and non-qualified XP classes may be mixed in one project. The XP group recommends migrating complete packages.
  • Inside classes using PHP namespaces, other XP classes need to be either addressed by their absolute fully-qualified names (e.g. \lang\Object) or imported via the use statement by their fully-qualified names; uses() may not be used there.
  • Inside classes not using PHP namespaces, namespaced classes must be added to the uses() list and addressed in their namespaced version.

As an example, if we have the following in de/thekid/tools/SQL.class.php:
  namespace de\thekid\tools;
use rdbms\DriverManager;

class SQL extends \lang\Object {
public
static function main(array $args) {
$conn= DriverManager::getConnection($args[0]);
// ...
}
}
To run this class, use xp de.thekid.tools.SQL ... as you would with a non-namespaced class.



Support for SQLite3 / SQLite2 deprecation

at 2012-01-06 in AnnouncementsDatabases by friebe

With pull request #104 implemented the XP Framework now supports SQLite v3 databases via PHP's sqlite3 extension. To acquire a "connection" to an SQLite database, use "." as the hostname and supply the filename where you usually put the database in the DSN string:

  $conn= DriverManager::getConnection('sqlite://./test.db?autoconnect=1');

Note: At the same time, the sqlite scheme was changed to default to this new implementation instead of the older SQLite version 2, which will be deprecated in PHP 5.4. To stick with the old implementation, use sqlite+std as scheme to forcefully select the old driver. If you want to be forward-compatible, you may upgrade existing SQLite files as follows: sqlite old.db .dump | sqlite3 new.db.



Explicitely selecting drivers in DriverManager

at 2011-12-30 in Databases by friebe

In a recent discussion in the XP Framework's issue tracker, the topic was brought up that the database connectivity layer was preferring the userland MySQL implementation over PHP's builtin-MySQL support. This change occurs in PHP versions using the mysqlnd implementation (default as of PHP 5.3.0) and was causing productive applications to malfunction.

While the change in the XP Framework was made due to the fact that mysqlnd doesn't support older MySQL versions, matching our BC strategy, and there should've been more testing before deploying upgraded versions of both PHP and the XP Framework, it's still undesirable that there's no easy way "back".


(more)

RFC #0222: Optional support for PHP 5.3 namespaces

at 2011-12-23 in 5.9-SERIESPHP5RFCs by friebe

Scope of Change
Support for writing and using classes within PHP 5.3 namespaces will be added to the XP Framework's core. Because PHP namespaces are only available with PHP >= 5.3.0, support will be optional - using XP with PHP 5.2.x just will not offer the feature.

Rationale
Add benefit of using namespaces in classes. Namespaces allow reusing class names in a separate context, removing the need of class name prefixes and thus increasing overall code readability.

Read the full RFC here



TDS Protocol implementation

at 2011-12-23 in PHP5EditorialDatabases by friebe

One of the XP Framework's strategies is to keep compatibility over a large number of PHP versions on multiple platforms. For example, the message digest API contains a workaround for certain PHP versions with a broken CRC32b implementation, hiding it transparently from the user. In other places like the lang.Process class, we take care of platform differences, employing OS and feature detection, and even compensating for some implementation vagaries. Constructs like this can be found in various other places in our code base, and while this is definitely not desirable, it at least saves the user from going through this hell, and this way, we support the full range of PHP 5.2.10 through 5.3.8 (inofficially 5.2.0 - 5.5.0-dev also works) on a variety of Windows and Un*x systems.

Following this strategy, we go as far as rewriting functionality previously available through a PHP extension to userland implementations: The FTP API (because of limitations in streaming support), the parse_url() function rewrite to work around behaviour changes, userland ini file parsing to support Unicode, a reimplemented MD5-crypt to compensate for a critical bug in crypt() in PHP 5.3.7 and our own MySQL protocol implementation to be able to support old MySQL 4.x instances, to name only a few cases.

The TDS protocol implementation supporting connectivity with Microsoft SQL Server and Sybase database servers is the most recent addition to this stack. Though not yet completely finished, we expect to be able to add it to one of the upcoming 5.8 releases.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES