Skip to content

Loading…

Making sure the default namespace used in Library::extract() is valid #561

Merged
merged 1 commit into from

2 participants

@ppadron

By default, the extract command will use the target directory name as the namespace. If the target directory name contains spaces or invalid characters, the extracted app will result in parsing errors. This patch uses Inflector::underscore() to make sure the resulting namespace is valid.

@nateabele nateabele merged commit 1cea1c9 into UnionOfRAD:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 4, 2012
  1. @ppadron

    making sure the default namespace used in Library::extract() is valid…

    ppadron committed
    … by underscoring the directory name
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1 console/command/Library.php
View
3 console/command/Library.php
@@ -13,6 +13,7 @@
use RuntimeException;
use lithium\core\Libraries;
use lithium\util\String;
+use lithium\util\Inflector;
/**
* The Library command is used to archive and extract Phar::GZ archives. Requires zlib extension.
@@ -237,7 +238,7 @@ public function extract($name = 'new', $result = null) {
$this->out(basename($to) . " created in " . dirname($to) . " from {$from}");
if (empty($this->namespace)) {
- $this->namespace = basename($to);
+ $this->namespace = Inflector::underscore(basename($to));
}
$replacements = $this->_findReplacements($to);
Something went wrong with that request. Please try again.