zz log

zaininnari Blog

CakePHP 1.2.7 のリリースとその変更点

公式アナウンス

CakePHP 1.2.7 released
http://bakery.cakephp.org/articles/view/cakephp-1-2-7-released

Since the release of CakePHP 1.2.6 in late January 2010, the development team have closed 36 tickets in 64 commits. This includes a recent minor security concern within the test suite. For those wishing to apply just the minor security patch to an existing installation, we have provided a patch [1] to resolve this issue. This concern is only present in sites that operate with the debug setting enabled, and does not affect deployments using a debug setting of zero.

変更点

  • セキュリティ関連の修正がメイン
  • 注意点
    • 最初の部分は省略しています
    • コミットの古い(下にあるもの)から作業しているため、途中で疲れています。
    • 肝心の下にあるものの数点は、電子の海に消えました。。。
      • はてダのバックアップの設定をしてあったのに、容量不足という不運




Commit: 3af22eec91d4e14d2c31f3bdee36b54e237b8c99


Adding tests from 'tfs' fixes inconsistencies in extracting elements with one path selector. Fixes #555




Commit: 629740d59631857996488a5aa420fbe629769450


Fixing discrepancy between how belongsTo and hasOne assocations are treated in relation to their fields being added into the queryData. hasOne and belongsTo associations now behave the same. Fixes #379

  • 影響:Containable behave


Commit: 46c4cab95bd10855ed607d983bd39d5a3e5f9fe4


Fixing Form::dateTime() for GET forms. Tests added. Fixes #522

Commit: 7e277e8239fc643f65c333a8076434a946ce5bbf


Restored ability to link PHP files for CSS and JS from view helpers.

  • PHPファイルも使えるようになった。


Commit: f56e24c64166d2c6e394265fb91d11de5ba52b15


Using Inflector::slug in Object::_persist() to avoid parse errors o malformed variable names, closes #365

  • 影響:なし
  • 変数を Inflector::slug を使って、パースできるようにする


Commit: 289a4e9085ed5b2de0ad937b0ee48111c8a76e2b


Moniro update to file construction.


Commit: 95c1ab3596d0e60964c0c6c99f0e033cb51dbd40


Fixing failing tests in SessionHelper caused by changes in CakeSession. Removing SessionHelper::id() as all it did was call the parent method.


Commit: 39a4566ddc4f5a366ab2526e4275cfc4aa3728e0


Fixing AclNode::node() so that node expressions that could match deeper elements are contained to their parent elements. Test added.





Commit: 5f3f66215aff2af90f06dee407a36adcf8f65f97


Removing return statements from File::__construct.


  • 影響なし
  • リファクタ



Commit: f846005dfd5dd2ec36357515346193c476a32176


Removed unnecessary override of Session::id() in SessionHelper.


  • 影響なし
  • そのまんま


Commit: 3040c6f586436df09231191b33c5ec41ac8cd683


Moving tests around in set test.

  • 影響なし
  • そのまんま


Commit: 35446a42a92907e767442a433384472c40480763


Making filtering of extracted arrays remember their key. This fixes attribute selectors followed by parent selectors returning seemingly random results. Fixes #502


Commit: b559be58221537b220f4bfd1a127e4914e22a349


Moving xml_parser_free() so parser resources are freed immediately after they are used. Helps reduce memory consumption in Xml class. Refs #505


Commit: abefca759a0305b2d945b68aff312a067fa6390b


Fix $host not being defined on SessionHelper.

  • 影響:SessionHelper
  • そのまんま



Commit: ec3f4b8d34005d533d5d0f6d4003e65971a3e394


Fixes #53, ordering of XML::toArray() operations.

  • 影響:XML::toArray() で結果配列の順序に意味を持つ場合
  • 自信なし
  • テストはあるけど、ソースはコメントアウトしただけで、よく把握できてない。



Commit: 9f5949ab5273048c76bf411d7c0057ba217d6132


Fix for Session Component to use CakeSession started() checks. Refs #332.


Commit: 9740029e9e2db239c54f8db53d69046e04ef0dbe


Fixes #332.


Commit: d95e482894927f8f9dbb80959d36a87d57467ed3


Refs #332. Beginning fix for multiple session starts.

  • 影響:SessionComponent
  • クッキーが多重に設定されるのを修正

Commit: 4f4d3f9ffe186ed5fde8c1b800903630e66b6113


Fixing extraction of non-zero arrays with only one element and attribute selectors. Fixes #475


  • 影響:Set::extract()
  • 自信なし
  • パス


Commit: cbb65ca85f514df59486b4ac02517d78b9c7e5a5


Moving failing test into new method for non-zero array extraction.


  • 影響:Set::extract()

  • リファクタ


Commit: e8e520d6f2114b2e954299ca95e7360f4d191535


Added test case for a bug in Set::extract


  • 影響:Set::extract()

  • バグのテストの追加


Commit: 9d3f2fb4a757e0cccbb590a5062dc4a29dff13e4


Moving Non-Zero tests for Set::extract() into a separate method.


影響:Set::extract() (但し、対象はテスト)

  • リファクタ


Commit: 6c8ce984aad2fa830da219cd2665c378cecec340


Adding import for String to ensure that String has been loaded when Security component is used without making any database connections. Fixes #482


  • 影響:security コンポーネントだけを呼ぶ場合
  • 依存する String クラスを読み込んでいなかった。


Commit: f65cb31cbea30b551369689990a1f0d78af0cc84


Updating documentation for Router::normalize(). Refs #486

  • 影響:なし
  • コメントの修正

Commit: c3aec39d75a944c2105adbaba286049e03311f02

Chaging array_push call for array_merge, as the first one would produce worng nested arrays in MediaView. closes #391

  • 影響:IE
  • 自信なし
  • array_push を array_merge に代えたのは理解できるけど、array_push は第1引数の配列に参照が付いているため、返値は気にする必要はないけど、 array_merge の結果は、返値で受け取らないと、期待する変化はないはず。array_merge の関数を呼ぶだけ損な気がする。


Commit: 28cb57a92c54a223fed4aacc738db5ccc8bc71c3


Fixing bug in Model::escapeField() where it would return the wrong string id the datasource's name method returs the unmodified string. Tests added. Closes #473


  • 影響:Model::escapeField()
  • 自信なし
  • 正しく「.」をつけて返さない場合があった。


Commit: bc990f41e3d29db70cf5c181a11668c8e63f4bdf


Prevent sql error for uuids if id is specified as null

  • 影響:sql
  • 自信なし
  • Column %s specified twice」(指定したカラムが2度指定されています。)エラーがでるらしい

Commit: 01a5738f3c7f8553d8203eb565c08beba6e79ca0


Effectively reverting changes made in [190066fd51c222de91989aec97b0042d7bcda7c9] which caused conditions using a falsey values to be removed.

  • 影響:sql
  • モデルで、'foreignKey' を指定しない意図で指定した値が、配列の参照時にキャストされ、$conditions がセットされてしまう。
    • empty関数で 'foreignKey' をチェックするようになった。

Commit: 661fcd32ab56b3c288c922c570ea141461d794ba


Fixing failing tests in PostgreSQL cause by invalid datatype comparisons and missing id fields.

Commit: ea64588a814b09565b82c428845f7a096814c327


Adding tests from 'Stephen Cuppert' to test incorrectly generate DELETE queries for habtm join tables that do not have a primary key when using PostgreSQL. Updating DboSource::_matchRecords() to only query the table if the supplied conditions are actually multi-table conditions. Fixes #459

  • 影響:PostgreSQL hasAndBelongsToMany に関連した削除
  • 自信なし
  • primary key を持っていないテーブルを対象とした削除をおこなった場合、そのテーブルのデータが削除されない


Commit: 190066fd51c222de91989aec97b0042d7bcda7c9


Adding array_filter() to remove empty conditions that can be caused by array casting an empty string.

  • 影響:hasAndBelongsToMany で'unique' が true (デフォルト)で  ’conditions’ に、 配列にキャストした際、1つの要素を持つ配列に変換される値を指定し、それが空文字や false 、0になる場合
  • 自信なし
  • 配列の値に、空文字や false 、0等の場合、削除されるようにした。
    • ’conditions’ の値をマージする際に、 (array) で配列にキャストしてマージ(array_merge)する際に、 ’’ -> array(1), false -> array(false) と変換され、マージすると、それらも引き継がれてしまう。
      • array_merge に array_filter(array_merge($arr1, $arr2)) と 第2引数なしの array_filter を被せるようにした。


Commit: daf02cad61a0979fe6cf85b0aa4e5f2d68a03c2b


Fixing CakeSchema index comparison that was causing failures in postgres tests.

  • 影響:PHP4 & PostgreSQL (但し、対象はテスト)

Commit: 3ab687043e57130cbee76ead4ad7865478da718b


Updating DboPostgres test to reflect changes in test suite.

  • 影響:なし

Commit: 8d58b40642c182afe307d00debf44a1dbd8a3c62


Fixing issue in Containable where if bindModel was used to add / change a binding not permanently, Containable was making the change permanent

  • 影響:Containable を使っている
    • モデルが持つバインド用のテンポラリ(__backAssociation)をチェックするようになった。

Commit: 64c627a35241cf9766a035fc02cdd78a908755ef


Adding checks to force limit to always be a positive integer. Fixes potential out of bounds type queries with paginate(). Fixes #418

  • 影響:controller::paginate()
  • $options['limit'] が 正の整数のみ受け付けるように修正
    • $options['limit'] は、まず、int にキャストされ、その後、1未満の場合は、1にするようになった


Commit: af317a107bdb179bce31323d0d28af2c333ebc12


Fixing issues in Set::combine() when data or paths used result in empty datasets. Tests added. Fixes #414

  • 影響:Set::combine()
  • 内部変数 $keys $values が空の場合、エラーが発生
    • 内部変数 $keys $values が空の場合、Set::combine() は 空の配列を返す。

Commit: 348fe6f57463aaa20d77984254f493d9ca4fe9f1


Expanding documentation for FormHelper::submit() Fixes #390

  • 影響:なし
  • FormHelper::submit() のオプションの説明を追加

Commit: 763aa524b95f666d1a20d7e58b896f39d830dbd0


Fixing recursive directory creation when nested create() calls fail. Fixes #347

  • 影響:Folder::create() を使っている
  •  Folder::create() が成功しても false を返していた
    • ture を返すようになった


Commit: f4c670e5be6bf6a9599d394669999fcadd01e4b1


Fixing lack of space in meta tags lacking a link attribute. Fixes #371

  • 影響:HtmlHelper::meta でコードを生成している(xhtml
  • メタタグの「/>」の前にスペースがなかった。「content="enter any meta keyword here"/>」 -> 「content="enter any meta keyword here" />」

Commit: ab688b88f408132a272b71b1c93dbb8ec42fcbad


Adding test to check that postfix and prefix options don't go into inner objects. Tests added, fixes #348

  • 影響:JavascriptHelper で JSのオブジェクトの生成をしている
  • オプションの postfix と prefix の初期化が不十分で、内部のオブジェクトに正しく伝わっていなかった。
    •  オプションの postfix と prefix の初期化を追加


Commit: 63f7900ba1647e2111b85d9445d3973f746f93f5


Checking if the last query returned a error, tests added. Fixes #72.

  • 影響:mssql で dbo を使っている
  • 自信なし
  • クエリーのエラーとデータベースのエラーを分けていないために、正常なクエリーまでもエラーを返すようになる。
    • クエリーのエラーとデータベースのエラーを分けるコードを追加

Commit: fc499ac48f9caa7e99d656f64c25b64d13348f98


Reversing order of short cut checks. Fixes issues in PHP 5.1.x. Fixes #351

  • 影響:PHP5.1 系で dbo を使っている
  • 自信なし
  •  PHP5.1 系で dbo を使っていると、「Notice (8): Object of class stdClass could not be converted to int 」という Notice エラーが出る模様
  • 以下のチェックを後回しにすると、解消したらしい。
<?php
if ($data == '*') {
&nbsp;return '*';
}

電子の海に消えたものより

Commit: 2cf294a749144b2cca2d06bab5db24abcb20f3c8
Fixing typo in Finland for sv-fi language. Fixes #308

癒された(*・ω・) < Findland!!


〜〜ここから追記〜〜

Commit: d5ea6b7c2a99bbda503f2247702aa4a6953dcf1b


Flushing the CR after a model is baked, tests added. Refs #310

  • 影響:bake
  • モデル作成後に、classregistry を初期化するようになった
    • モデルを先に作成すると、アソシエーションの情報が controller と view に正しく伝わっておらず、再生成する必要があった。

Commit:
104da15a737a13283f827d049beb1d0bea5344d5


Making built-in Canadian postal code validation accept postal
codes with no spaces. Fixes #289

  • 影響:カナダの郵便番号を validation
  • カナダの郵便番号の validation が緩くなった
<?php
// 変更前 : 'L4J8D6' (FAIL), 'L4J 8D6' (OK)
$_this->regex  = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]\\b\\z/i';
// 変更後 : 'L4J8D6' (OK),   'L4J 8D6' (OK)
$_this->regex  = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] ?[0-9][A-Z][0-9]\\b\\z/i';

Commit:
2c1e6de7d628f38904f79ad631d5378254399305


Another fix for array_values() throwing a warning when using
Tree Behavior under certain situations.


Commit:
205c95ef65e3a41cfef6ab11ffa1fa044e967470


Fix array_values() warning when using Tree Behavior under
certain situations.

  • 影響:Tree Behavior
  • array array_values ( array $input ) の引数に false を渡す可能性があった
    • 一旦別の変数に退避して、値をチェックするようになった

Commit:
8d382d9168e98140367e908d1855e70292b71f5f


Fixes #288. TextHelper truncation not playing nice with
html in ending.

  • 影響:TextHelper::truncation で $ending に html タグを設定している
  • $ending に含まれる html タグまで、省略する文字数に含まれていた。
    • strip_tags 関数により、すべての html タグを削除した状態で文字数をカウントするようになった。
  • その他 :マルチバイトに対応しているなぁ、と思ったら、1ヶ所だけ、規程の文字数と与えられた文字列の比較の所で、strlen が使われていた。$ending (「...」の文字を指定する所)にマルチバイトを与えると、予想以上に、出力する文字が短くなる。と思うのだけど、ここ1ヶ所だけのため、仕様かな、と思える。
<?php
if (mb_strlen($text) <= $length) {
	return $text;
} else {
	$truncate = mb_substr($text, 0, $length - strlen($ending));
}

あとのコミットは、コメント部分の修正のため、省略です。