diff --git a/src/xPDO/Transport/xPDOObjectVehicle.php b/src/xPDO/Transport/xPDOObjectVehicle.php index bc4529d4..b9308240 100644 --- a/src/xPDO/Transport/xPDOObjectVehicle.php +++ b/src/xPDO/Transport/xPDOObjectVehicle.php @@ -387,7 +387,7 @@ public function put(& $transport, & $object, $attributes = array ()) { parent :: put($transport, $object, $attributes); if (is_object($object)) { if (!isset ($this->payload['package'])) { - if ($object instanceof xPDOObject) { + if ($object instanceof xPDOObject && strpos(get_class($object), '\\') === false) { $packageName = $object->_package; } else { $packageName = ''; diff --git a/src/xPDO/Transport/xPDOVehicle.php b/src/xPDO/Transport/xPDOVehicle.php index 7c716f66..238f4ba8 100644 --- a/src/xPDO/Transport/xPDOVehicle.php +++ b/src/xPDO/Transport/xPDOVehicle.php @@ -287,7 +287,7 @@ public function put(& $transport, & $object, $attributes = array ()) { $this->payload['guid'] = md5(uniqid(rand(), true)); } if (!isset ($this->payload['package'])) { - if ($object instanceof xPDOObject) { + if ($object instanceof xPDOObject && strpos(get_class($object), '\\') === false) { $packageName = $object->_package; } else { $packageName = ''; diff --git a/test/complete.phpunit.xml b/test/complete.phpunit.xml index 4140a1a6..1531af41 100644 --- a/test/complete.phpunit.xml +++ b/test/complete.phpunit.xml @@ -29,6 +29,7 @@ ./xPDO/Test/Cache/xPDOCacheDbTest.php ./xPDO/Test/Compression/xPDOZipTest.php ./xPDO/Test/Transport/xPDOTransportTest.php + ./xPDO/Test/Transport/xPDOVehicleTest.php ./xPDO/Test/PSR4/xPDOTest.php ./xPDO/Test/TearDownTest.php diff --git a/test/mysql.phpunit.xml b/test/mysql.phpunit.xml index 4140a1a6..1531af41 100644 --- a/test/mysql.phpunit.xml +++ b/test/mysql.phpunit.xml @@ -29,6 +29,7 @@ ./xPDO/Test/Cache/xPDOCacheDbTest.php ./xPDO/Test/Compression/xPDOZipTest.php ./xPDO/Test/Transport/xPDOTransportTest.php + ./xPDO/Test/Transport/xPDOVehicleTest.php ./xPDO/Test/PSR4/xPDOTest.php ./xPDO/Test/TearDownTest.php diff --git a/test/pgsql.phpunit.xml b/test/pgsql.phpunit.xml index ebde7984..bcc32639 100644 --- a/test/pgsql.phpunit.xml +++ b/test/pgsql.phpunit.xml @@ -29,6 +29,7 @@ ./xPDO/Test/Cache/xPDOCacheDbTest.php ./xPDO/Test/Compression/xPDOZipTest.php ./xPDO/Test/Transport/xPDOTransportTest.php + ./xPDO/Test/Transport/xPDOVehicleTest.php ./xPDO/Test/PSR4/xPDOTest.php ./xPDO/Test/TearDownTest.php diff --git a/test/sqlite.phpunit.xml b/test/sqlite.phpunit.xml index 5cd1bb07..c21b4068 100644 --- a/test/sqlite.phpunit.xml +++ b/test/sqlite.phpunit.xml @@ -29,6 +29,7 @@ ./xPDO/Test/Cache/xPDOCacheDbTest.php ./xPDO/Test/Compression/xPDOZipTest.php ./xPDO/Test/Transport/xPDOTransportTest.php + ./xPDO/Test/Transport/xPDOVehicleTest.php ./xPDO/Test/PSR4/xPDOTest.php ./xPDO/Test/TearDownTest.php diff --git a/test/xPDO/Test/Transport/xPDOVehicleTest.php b/test/xPDO/Test/Transport/xPDOVehicleTest.php new file mode 100644 index 00000000..ac5b497a --- /dev/null +++ b/test/xPDO/Test/Transport/xPDOVehicleTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace xPDO\Test\Transport; + + +use xPDO\Test\Sample\xPDOSample; +use xPDO\TestCase; +use xPDO\Transport\xPDOObjectVehicle; +use xPDO\Transport\xPDOTransport; + +class xPDOVehicleTest extends TestCase +{ + public function testPutDoesNotAddPackageForNamespacedClass() + { + $transport = new xPDOTransport($this->xpdo, uniqid('transport-'), self::$properties['xpdo_test_path'] . 'fs/transport/'); + + $object = $this->xpdo->newObject(xPDOSample::class); + + $vehicle = new xPDOObjectVehicle(); + $vehicle->put($transport, $object); + + $this->assertEmpty($vehicle->payload['package']); + } +} \ No newline at end of file