From 31d9cbd9a1abe0ca679ba603150404b63f4d376b Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Wed, 22 May 2013 23:41:50 +0200 Subject: [PATCH 01/16] added run method to execute yii commands --- .../composer/yii/composer/InstallHandler.php | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 6d43abd..794ec24 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -9,10 +9,16 @@ namespace yii\composer; use Composer\Script\CommandEvent; +defined('YII_DEBUG') or define('YII_DEBUG', true); + +// fcgi doesn't have STDIN defined by default +defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); + /** * InstallHandler is called by Composer after it installs/updates the current package. * * @author Qiang Xue + * @author Tobias Munk * @since 2.0 */ class InstallHandler @@ -50,4 +56,31 @@ class InstallHandler } } } + + /** + * Executes a yii command. + * @param CommandEvent $event + */ + public static function run($event) + { + $options = array_merge(array( + 'run' => array(), + ), $event->getComposer()->getPackage()->getExtra()); + + $appPath = realpath(__DIR__ . '/../../../../..'); + + require($appPath . '/vendor/yiisoft/yii2/yii/Yii.php'); + require($appPath . '/vendor/autoload.php'); + $config = require($appPath . '/config/console.php'); + + foreach((array)$options['run'] as $params){ + $command = $params[0]; + unset($params[0]); + $params = array(); + // TODO: add params to array + echo "Running command: {$command}\n"; + $application = new \yii\console\Application($config); + $application->runAction($command, $params); + } + } } From d878520c38cc8d0459a3deab0599d764059beb74 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 00:04:06 +0200 Subject: [PATCH 02/16] fixed formatting --- extensions/composer/yii/composer/InstallHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 794ec24..961f39b 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -64,8 +64,8 @@ class InstallHandler public static function run($event) { $options = array_merge(array( - 'run' => array(), - ), $event->getComposer()->getPackage()->getExtra()); + 'run' => array(), + ), $event->getComposer()->getPackage()->getExtra()); $appPath = realpath(__DIR__ . '/../../../../..'); From 8e6b427f60718d29c74f42358125860a59657e7a Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 12:25:18 +0200 Subject: [PATCH 03/16] removed composer autoloading, since it's already active --- extensions/composer/yii/composer/InstallHandler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 961f39b..0f121e6 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -70,7 +70,6 @@ class InstallHandler $appPath = realpath(__DIR__ . '/../../../../..'); require($appPath . '/vendor/yiisoft/yii2/yii/Yii.php'); - require($appPath . '/vendor/autoload.php'); $config = require($appPath . '/config/console.php'); foreach((array)$options['run'] as $params){ From f53b21758930c13432466b87ef4832bf83333e68 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 12:26:11 +0200 Subject: [PATCH 04/16] added parsing of anonymous params --- extensions/composer/yii/composer/InstallHandler.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 0f121e6..2b3661d 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -8,6 +8,7 @@ namespace yii\composer; use Composer\Script\CommandEvent; +use yii\console; defined('YII_DEBUG') or define('YII_DEBUG', true); @@ -72,11 +73,13 @@ class InstallHandler require($appPath . '/vendor/yiisoft/yii2/yii/Yii.php'); $config = require($appPath . '/config/console.php'); - foreach((array)$options['run'] as $params){ - $command = $params[0]; - unset($params[0]); - $params = array(); - // TODO: add params to array + foreach ((array)$options['run'] as $rawParams) { + // TODO: we're doing about the same here like console\Request::resolve() + $command = $rawParams[0]; + unset($rawParams[0]); + $params[\yii\console\Request::ANONYMOUS_PARAMS] = $rawParams; + // TODO end + echo "Running command: {$command}\n"; $application = new \yii\console\Application($config); $application->runAction($command, $params); From e7c98a499e454e533110dd9c972df15043aa6d60 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 16:02:39 +0200 Subject: [PATCH 05/16] added configuration file detection from composer.json (extra.config), path cleanup --- extensions/composer/yii/composer/InstallHandler.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 2b3661d..6ac645a 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -66,12 +66,21 @@ class InstallHandler { $options = array_merge(array( 'run' => array(), + 'config' => null, ), $event->getComposer()->getPackage()->getExtra()); - $appPath = realpath(__DIR__ . '/../../../../..'); + // resolve and include config file + if (($options['config'] === null)) { + throw new console\Exception('Config file not specified in composer.json extra.config'); + } else { + if (!is_file(getcwd() . '/' . $options['config'])) { + throw new console\Exception("Config file '{$options['config']}' specified in composer.json extra.config not found"); + } else { + $config = require($options['config']); + } + } - require($appPath . '/vendor/yiisoft/yii2/yii/Yii.php'); - $config = require($appPath . '/config/console.php'); + require(__DIR__ . '/../../../yii2/yii/Yii.php'); foreach ((array)$options['run'] as $rawParams) { // TODO: we're doing about the same here like console\Request::resolve() From c73ab91099282936bbc06cc1831da601cd32e3d6 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 18:16:18 +0200 Subject: [PATCH 06/16] added line-break after message --- apps/bootstrap/commands/HelloController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/bootstrap/commands/HelloController.php b/apps/bootstrap/commands/HelloController.php index 16f5f74..b5ecac2 100644 --- a/apps/bootstrap/commands/HelloController.php +++ b/apps/bootstrap/commands/HelloController.php @@ -24,6 +24,6 @@ class HelloController extends Controller */ public function actionIndex($message = 'hello world') { - echo $message; + echo $message."\n"; } } \ No newline at end of file From 8264c5c51d13a513bd650529286170bd89cab491 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 18:17:50 +0200 Subject: [PATCH 07/16] refactored param parsing --- extensions/composer/yii/composer/InstallHandler.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 6ac645a..1171889 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -80,17 +80,17 @@ class InstallHandler } } + // prepare console application require(__DIR__ . '/../../../yii2/yii/Yii.php'); + $application = new \yii\console\Application($config); + $request = $application->getRequest(); - foreach ((array)$options['run'] as $rawParams) { - // TODO: we're doing about the same here like console\Request::resolve() - $command = $rawParams[0]; - unset($rawParams[0]); - $params[\yii\console\Request::ANONYMOUS_PARAMS] = $rawParams; - // TODO end - + // run commands from extra.run + foreach ((array)$options['run'] as $rawCommand) { + $opts = str_getcsv($rawCommand, ' '); // see http://stackoverflow.com/a/6609509/291573 + $request->setParams($opts); + list($command, $params) = $request->resolve(); echo "Running command: {$command}\n"; - $application = new \yii\console\Application($config); $application->runAction($command, $params); } } From 34793c1303206a6e3ee8872cd21f270d471250c0 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 23 May 2013 18:33:48 +0200 Subject: [PATCH 08/16] added full display of command --- extensions/composer/yii/composer/InstallHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 1171889..0c4eb2b 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -90,7 +90,7 @@ class InstallHandler $opts = str_getcsv($rawCommand, ' '); // see http://stackoverflow.com/a/6609509/291573 $request->setParams($opts); list($command, $params) = $request->resolve(); - echo "Running command: {$command}\n"; + echo "Running command: yiic {$rawCommand}\n"; $application->runAction($command, $params); } } From ebe31c5f604338a50de9e6ece52852a16c3e2778 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 23 May 2013 13:24:10 -0400 Subject: [PATCH 09/16] Fixes issue 380: invalid route exception should be 404. --- framework/yii/web/Application.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/yii/web/Application.php b/framework/yii/web/Application.php index 3387044..a786985 100644 --- a/framework/yii/web/Application.php +++ b/framework/yii/web/Application.php @@ -8,6 +8,8 @@ namespace yii\web; use Yii; +use yii\base\HttpException; +use yii\base\InvalidRouteException; /** * Application is the base class for all application classes. @@ -25,6 +27,7 @@ class Application extends \yii\base\Application /** * Processes the request. * @return integer the exit status of the controller action (0 means normal, non-zero values mean abnormal) + * @throws HttpException if the request cannot be resolved. */ public function processRequest() { @@ -32,7 +35,11 @@ class Application extends \yii\base\Application Yii::setAlias('@wwwroot', dirname($request->getScriptFile())); Yii::setAlias('@www', $request->getBaseUrl()); list ($route, $params) = $request->resolve(); - return $this->runAction($route, $params); + try { + return $this->runAction($route, $params); + } catch (InvalidRouteException $e) { + throw new HttpException(404, $e->getMessage(), $e->getCode(), $e); + } } private $_homeUrl; From 8e1079cd047aedd026cb10be9999c60174c59a23 Mon Sep 17 00:00:00 2001 From: resurtm Date: Thu, 23 May 2013 23:33:33 +0600 Subject: [PATCH 10/16] MSSQL more tests. --- tests/unit/data/mssql.sql | 2 +- tests/unit/framework/db/mssql/MssqlCommandTest.php | 55 +++++++++++++++++++++- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/tests/unit/data/mssql.sql b/tests/unit/data/mssql.sql index d3bc8d2..959c6c6 100644 --- a/tests/unit/data/mssql.sql +++ b/tests/unit/data/mssql.sql @@ -62,7 +62,7 @@ CREATE TABLE [dbo].[tbl_type] ( [char_col3] [text], [float_col] [decimal](4,3) NOT NULL, [float_col2] [float] DEFAULT '1.23', - [blob_col] [binary], + [blob_col] [varbinary](MAX), [numeric_col] [decimal](5,2) DEFAULT '33.22', [time] [datetime] NOT NULL DEFAULT '2002-01-01 00:00:00', [bool_col] [tinyint] NOT NULL, diff --git a/tests/unit/framework/db/mssql/MssqlCommandTest.php b/tests/unit/framework/db/mssql/MssqlCommandTest.php index 422a00c..11d7565 100644 --- a/tests/unit/framework/db/mssql/MssqlCommandTest.php +++ b/tests/unit/framework/db/mssql/MssqlCommandTest.php @@ -21,11 +21,62 @@ class MssqlCommandTest extends \yiiunit\framework\db\CommandTest function testPrepareCancel() { - $this->markTestIncomplete(); + $this->markTestSkipped('MSSQL driver does not support this feature.'); } function testBindParamValue() { - $this->markTestIncomplete(); + $db = $this->getConnection(); + + // bindParam + $sql = 'INSERT INTO tbl_customer(email, name, address) VALUES (:email, :name, :address)'; + $command = $db->createCommand($sql); + $email = 'user4@example.com'; + $name = 'user4'; + $address = 'address4'; + $command->bindParam(':email', $email); + $command->bindParam(':name', $name); + $command->bindParam(':address', $address); + $command->execute(); + + $sql = 'SELECT name FROM tbl_customer WHERE email=:email'; + $command = $db->createCommand($sql); + $command->bindParam(':email', $email); + $this->assertEquals($name, $command->queryScalar()); + + $sql = 'INSERT INTO tbl_type (int_col, char_col, float_col, blob_col, numeric_col, bool_col) VALUES (:int_col, :char_col, :float_col, CONVERT([varbinary], :blob_col), :numeric_col, :bool_col)'; + $command = $db->createCommand($sql); + $intCol = 123; + $charCol = 'abc'; + $floatCol = 1.23; + $blobCol = "\x10\x11\x12"; + $numericCol = '1.23'; + $boolCol = false; + $command->bindParam(':int_col', $intCol); + $command->bindParam(':char_col', $charCol); + $command->bindParam(':float_col', $floatCol); + $command->bindParam(':blob_col', $blobCol); + $command->bindParam(':numeric_col', $numericCol); + $command->bindParam(':bool_col', $boolCol); + $this->assertEquals(1, $command->execute()); + + $sql = 'SELECT int_col, char_col, float_col, CONVERT([nvarchar], blob_col) AS blob_col, numeric_col FROM tbl_type'; + $row = $db->createCommand($sql)->queryRow(); + $this->assertEquals($intCol, $row['int_col']); + $this->assertEquals($charCol, trim($row['char_col'])); + $this->assertEquals($floatCol, $row['float_col']); + $this->assertEquals($blobCol, $row['blob_col']); + $this->assertEquals($numericCol, $row['numeric_col']); + + // bindValue + $sql = 'INSERT INTO tbl_customer(email, name, address) VALUES (:email, \'user5\', \'address5\')'; + $command = $db->createCommand($sql); + $command->bindValue(':email', 'user5@example.com'); + $command->execute(); + + $sql = 'SELECT email FROM tbl_customer WHERE name=:name'; + $command = $db->createCommand($sql); + $command->bindValue(':name', 'user5'); + $this->assertEquals('user5@example.com', $command->queryScalar()); } } From d67416ab8be16f1cf263adc9865621e1478d98ce Mon Sep 17 00:00:00 2001 From: resurtm Date: Thu, 23 May 2013 23:41:57 +0600 Subject: [PATCH 11/16] MSSQL: select what is really needed from information_schema.columns, not just everything as it was before. --- framework/yii/db/mssql/Schema.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/yii/db/mssql/Schema.php b/framework/yii/db/mssql/Schema.php index c52dfc3..add6185 100644 --- a/framework/yii/db/mssql/Schema.php +++ b/framework/yii/db/mssql/Schema.php @@ -163,7 +163,7 @@ class Schema extends \yii\db\Schema $column->isPrimaryKey = null; // primary key will be determined in findColumns() method $column->autoIncrement = $info['IsIdentity'] == 1; $column->unsigned = stripos($column->dbType, 'unsigned') !== false; - $column->comment = $info['Comment'] === null ? '' : $column['Comment']; + $column->comment = $info['Comment'] === null ? '' : $info['Comment']; $column->type = self::TYPE_STRING; if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) { @@ -221,7 +221,7 @@ class Schema extends \yii\db\Schema $sql = << Date: Thu, 23 May 2013 13:53:33 -0400 Subject: [PATCH 12/16] refactored InstallHandler. --- apps/bootstrap/composer.json | 4 +- .../composer/yii/composer/InstallHandler.php | 51 +++++++++++----------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/apps/bootstrap/composer.json b/apps/bootstrap/composer.json index 6bd87cc..d44e35a 100644 --- a/apps/bootstrap/composer.json +++ b/apps/bootstrap/composer.json @@ -27,11 +27,11 @@ ] }, "extra": { - "writable": [ + "yii-install-writable": [ "runtime", "www/assets" ], - "executable": [ + "yii-install-executable": [ "yii" ] } diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 0c4eb2b..20f4c26 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -8,7 +8,8 @@ namespace yii\composer; use Composer\Script\CommandEvent; -use yii\console; +use yii\console\Application; +use yii\console\Exception; defined('YII_DEBUG') or define('YII_DEBUG', true); @@ -24,6 +25,11 @@ defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); */ class InstallHandler { + const PARAM_WRITABLE = 'yii-install-writable'; + const PARAM_EXECUTABLE = 'yii-install-executable'; + const PARAM_CONFIG = 'yii-install-config'; + const PARAM_COMMANDS = 'yii-install-commands'; + /** * Sets the correct permissions of files and directories. * @param CommandEvent $event @@ -31,11 +37,11 @@ class InstallHandler public static function setPermissions($event) { $options = array_merge(array( - 'writable' => array(), - 'executable' => array(), + self::PARAM_WRITABLE => array(), + self::PARAM_EXECUTABLE => array(), ), $event->getComposer()->getPackage()->getExtra()); - foreach ((array)$options['writable'] as $path) { + foreach ((array)$options[self::PARAM_WRITABLE] as $path) { echo "Setting writable: $path ..."; if (is_dir($path)) { chmod($path, 0777); @@ -46,7 +52,7 @@ class InstallHandler } } - foreach ((array)$options['executable'] as $path) { + foreach ((array)$options[self::PARAM_EXECUTABLE] as $path) { echo "Setting executable: $path ..."; if (is_file($path)) { chmod($path, 0755); @@ -65,33 +71,28 @@ class InstallHandler public static function run($event) { $options = array_merge(array( - 'run' => array(), - 'config' => null, + self::PARAM_COMMANDS => array(), ), $event->getComposer()->getPackage()->getExtra()); - // resolve and include config file - if (($options['config'] === null)) { - throw new console\Exception('Config file not specified in composer.json extra.config'); - } else { - if (!is_file(getcwd() . '/' . $options['config'])) { - throw new console\Exception("Config file '{$options['config']}' specified in composer.json extra.config not found"); - } else { - $config = require($options['config']); - } + if (!isset($options[self::PARAM_CONFIG])) { + throw new Exception('Please specify the "' . self::PARAM_CONFIG . '" parameter in composer.json.'); + } + $configFile = getcwd() . '/' . $options[self::PARAM_CONFIG]; + if (!is_file($configFile)) { + throw new Exception("Config file does not exist: $configFile"); } - // prepare console application require(__DIR__ . '/../../../yii2/yii/Yii.php'); - $application = new \yii\console\Application($config); + $application = new Application(require($configFile)); $request = $application->getRequest(); - // run commands from extra.run - foreach ((array)$options['run'] as $rawCommand) { - $opts = str_getcsv($rawCommand, ' '); // see http://stackoverflow.com/a/6609509/291573 - $request->setParams($opts); - list($command, $params) = $request->resolve(); - echo "Running command: yiic {$rawCommand}\n"; - $application->runAction($command, $params); + foreach ((array)$options[self::PARAM_COMMANDS] as $command) { + $params = str_getcsv($command, ' '); // see http://stackoverflow.com/a/6609509/291573 + array_shift($params); + $request->setParams($params); + list($route, $params) = $request->resolve(); + echo "Running command: yii {$command}\n"; + $application->runAction($route, $params); } } } From 89e3077108605a4b27bf195fbcf7d7ef2a54ea08 Mon Sep 17 00:00:00 2001 From: resurtm Date: Fri, 24 May 2013 00:06:40 +0600 Subject: [PATCH 13/16] MSSQL column case consistency. --- framework/yii/db/mssql/Schema.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/framework/yii/db/mssql/Schema.php b/framework/yii/db/mssql/Schema.php index add6185..1991542 100644 --- a/framework/yii/db/mssql/Schema.php +++ b/framework/yii/db/mssql/Schema.php @@ -156,14 +156,14 @@ class Schema extends \yii\db\Schema { $column = new ColumnSchema(); - $column->name = $info['COLUMN_NAME']; - $column->allowNull = $info['IS_NULLABLE'] == 'YES'; - $column->dbType = $info['DATA_TYPE']; + $column->name = $info['column_name']; + $column->allowNull = $info['is_nullable'] == 'YES'; + $column->dbType = $info['data_type']; $column->enumValues = array(); // mssql has only vague equivalents to enum $column->isPrimaryKey = null; // primary key will be determined in findColumns() method - $column->autoIncrement = $info['IsIdentity'] == 1; + $column->autoIncrement = $info['is_identity'] == 1; $column->unsigned = stripos($column->dbType, 'unsigned') !== false; - $column->comment = $info['Comment'] === null ? '' : $info['Comment']; + $column->comment = $info['comment'] === null ? '' : $info['comment']; $column->type = self::TYPE_STRING; if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) { @@ -191,11 +191,11 @@ class Schema extends \yii\db\Schema $column->phpType = $this->getColumnPhpType($column); - if ($info['COLUMN_DEFAULT'] == '(NULL)') { - $info['COLUMN_DEFAULT'] = null; + if ($info['column_default'] == '(NULL)') { + $info['column_default'] = null; } - if ($column->type !== 'timestamp' || $info['COLUMN_DEFAULT'] !== 'CURRENT_TIMESTAMP') { - $column->defaultValue = $column->typecast($info['COLUMN_DEFAULT']); + if ($column->type !== 'timestamp' || $info['column_default'] !== 'CURRENT_TIMESTAMP') { + $column->defaultValue = $column->typecast($info['column_default']); } return $column; @@ -221,9 +221,9 @@ class Schema extends \yii\db\Schema $sql = << Date: Thu, 23 May 2013 14:30:53 -0400 Subject: [PATCH 14/16] bug fix. --- extensions/composer/yii/composer/InstallHandler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/composer/yii/composer/InstallHandler.php b/extensions/composer/yii/composer/InstallHandler.php index 20f4c26..9e36a35 100644 --- a/extensions/composer/yii/composer/InstallHandler.php +++ b/extensions/composer/yii/composer/InstallHandler.php @@ -88,7 +88,6 @@ class InstallHandler foreach ((array)$options[self::PARAM_COMMANDS] as $command) { $params = str_getcsv($command, ' '); // see http://stackoverflow.com/a/6609509/291573 - array_shift($params); $request->setParams($params); list($route, $params) = $request->resolve(); echo "Running command: yii {$command}\n"; From e8b9475502de1ee28155696f8cf9f74e908c2fb7 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 23 May 2013 15:12:45 -0400 Subject: [PATCH 15/16] changed dependency of composer installer --- extensions/composer/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/composer/composer.json b/extensions/composer/composer.json index 49f99fe..d8cf49d 100644 --- a/extensions/composer/composer.json +++ b/extensions/composer/composer.json @@ -19,7 +19,7 @@ ], "minimum-stability": "dev", "require": { - "yiisoft/yii2": "dev-master" + "yiisoft/yii2": "*" }, "autoload": { "psr-0": { "yii\\composer": "" } From 153e51df94c93d8d4d925c9c2a8b5967489225b9 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 23 May 2013 23:34:12 +0400 Subject: [PATCH 16/16] Html::url() fix for anchors --- framework/yii/helpers/base/Html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/helpers/base/Html.php b/framework/yii/helpers/base/Html.php index f601772..90396ec 100644 --- a/framework/yii/helpers/base/Html.php +++ b/framework/yii/helpers/base/Html.php @@ -1364,7 +1364,7 @@ class Html return Yii::$app->getRequest()->getUrl(); } else { $url = Yii::getAlias($url); - if ($url[0] === '/' || strpos($url, '://')) { + if ($url[0] === '/' || $url[0] === '#' || strpos($url, '://')) { return $url; } else { return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;