Sophie

Sophie

distrib > Mandriva > cooker > x86_64 > by-pkgid > 696ab6d939cc7bb56b651a0a3a4eaf41 > files > 13

php-shp-0.9.2-14.x86_64.rpm

--TEST--
Testing shp_read_object()  shp_write_object()
--FILE--
<?php 
error_reporting(E_ALL & ~E_STRICT);
if (!extension_loaded('shp')) dl('shp.so');

exec('cp /tmp/lakes.shp /tmp/lakes_for_update.shp');
exec('cp /tmp/lakes.shx /tmp/lakes_for_update.shx');
echo "Opening again for r/w: ";
$shph = shp_open("/tmp/lakes_for_update.shp", "rb+");
var_dump($shph);
echo "Extracting object 2: ";
$shp_obj = shp_read_object($shph, 2);
var_dump($shp_obj);
echo "Now writing at the end (no error): ";
$res = shp_write_object($shph, -1, $shp_obj);
var_dump($res);
echo "Now closing the file: ";
$res = shp_close($shph);
var_dump($res);
unlink('/tmp/lakes_for_update.shp');
unlink('/tmp/lakes_for_update.shx');

echo "\n-END-\n";
?>
--EXPECTF--
Opening again for r/w: resource(%d) of type (SHP Handle)
Extracting object 2: resource(%d) of type (SHP Object)
Now writing at the end (no error): int(3)
Now closing the file: bool(true)

-END-