Posted by Julien Biezemans on 05/22/06 18:45
I just wanted to share my experience: the wrappers do the job very well.
I have built a wrapper which jails local file streams to a specific
directory. This allows the following behavior:
<?php
$fh = fopen('/catalog/main.xml', 'r');
?>
Actually opens up '/srv/app_root/catalog/main.xml'. Internal functions
are authorized to open non jailed files by using the dynamic
free.file-XX:// stream scheme (where XX are changing figures). This
prevents XML document to refer to out-of-jail documents within Xinclude
elements or other proprietary stuffs.
As libxml PHP extension makes use of streams:
<?php
DOMDocument::load('/catalog/main.xml');
?>
Does work too, that's really nice.
Remember that I had to upgrade from PHP 5.1.2 to 5.1.4 to prevent
strange segfaults in the wrappers.
Maybe this can inspire someone.
Julien.
[Back to original message]
|