Commit graph

828 commits

Author SHA1 Message Date
mark_story
a2673d8bf0 Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/Core/App.php
2014-06-25 09:22:10 -04:00
Dan Voyce
239af0322e Raise an exception when Hash::get() receives invalid parameters
I'm not sure on whether this is a problem with my local app but I have
seen it a couple of times in a couple of projects: Warning (2): Invalid
argument supplied for foreach() [CORE/Cake/Utility/Hash.php, line 52]

I think Hash::get should be able to handle this better rather than
throwing an error in a core Util file.

Refs #3754
2014-06-25 09:15:46 -04:00
suzuki86
8f9589f7c8 Fix typo 2014-06-25 00:20:54 +09:00
ADmad
9a1a965b1c Update isAbsolute() to recognize stream wrapper paths.
This has the benefit that the realpath() method is not applied to a
registered stream wrapper in the constructor of the Folder class.
Using the realpath() method will break the stream.

Thank "davalb" for the original patch.
2014-06-22 13:43:14 +05:30
mark_story
497ecd3f80 Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/VERSION.txt
2014-06-19 21:41:02 -04:00
euromark
9c035ff315 doc block corrections 2014-06-19 13:25:36 +02:00
euromark
53a544d9f0 Improve toList to allow localization 2014-06-18 17:56:35 +02:00
Dan Voyce
4915639efb Update Inflector.php
Added Research
2014-06-18 11:48:16 +10:00
mark_story
fa19c34580 Fix Hash::extract() not matching 1/0 to true/false.
Historically [prop=1] has matched prop=true as well. This restores that
and also fixes [prop=0] not finding falsey values.

This makes the typing less strict in Hash::extract() but I don't think
it is unreasonable given PHP's type juggling.

Refs #3288
2014-06-12 11:30:48 -04:00
mark_story
8e14b2f807 Merge branch 'master' into 2.6 2014-06-11 23:05:59 -04:00
ADmad
1d40f3e685 Fix API docblock CS errors. 2014-06-05 00:28:55 +05:30
mark_story
92eeef8ae0 Merge branch 'master' into 2.6 2014-06-02 22:57:25 -04:00
ADmad
543066f34a Set default sort direction to 'asc'. 2014-05-30 19:43:09 +05:30
mark_story
7e8d378502 Merge branch 'master' into 2.6 2014-05-29 21:46:16 -04:00
mark_story
390441d3b9 Accept older blowfish hashes.
Both `2a` and `2x` are valid types of blowfish hashes, that while being
older should be accepted.

Backport 00c94bd582b83f8b92228b750aea0e8816a4ea89 from 3.x to 2.5.x,
I see this as a bug fix as it fixes incompatibilities with hashes
created by hash_password().

Refs #3575
2014-05-28 22:53:21 -04:00
ADmad
7a4244d0a6 More docblock CS fixes. 2014-05-28 22:09:54 +05:30
Mark Story
9c9d45596f Merge pull request #3478 from Schlaefer/#3303-lengthBetween
closes #3303 RFC: Rename Validator::between() into Validator::length()
2014-05-24 16:48:05 -04:00
Marlin Cremers
1977d51a49 Add 'feedback' to uninflected single and plurals 2014-05-19 20:57:11 +02:00
euromark
143e8e4c56 Make sure invalid arrays return empty array instead of throwing notices. 2014-05-14 23:53:58 +02:00
Schlaefer
3ac731273e adds backwards compatible 'between' alias for 'lengthBetween' validation rule 2014-05-13 17:36:23 +02:00
Schlaefer
4848b63189 closes #3303 RFC: Rename Validator::between() into Validator::length() 2014-05-13 09:31:03 +02:00
mark_story
89cd114e6f Merge branch 'master' into 2.5 2014-05-12 14:30:02 -04:00
mark_story
92e6c138c5 Add missing static on Debugger::output()
This method should have been static the whole time, and the lack of
static was causing tests to fail on PHP 5.6
2014-05-12 14:29:10 -04:00
ADmad
d466e00644 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
	lib/Cake/Utility/Folder.php
	lib/Cake/VERSION.txt
2014-05-04 14:35:36 +05:30
euromark
7a287a6942 More coding standard corrections. 2014-04-29 14:19:33 +02:00
euromark
0c036f6370 Remove unncessary language support. 2014-04-23 18:07:08 +02:00
euromark
7e6bc48ef2 Complete Inflector transliterations. 2014-04-23 16:43:44 +02:00
mark_story
d54fbe6f60 Merge branch 'master' into 2.5 2014-04-18 22:13:56 -04:00
mark_story
d4ae2b0b88 Correct types for Validation::range().
Refs #3304
2014-04-13 06:16:24 -04:00
mark_story
bf9c3029cb Merge branch 'master' into 2.5 2014-04-10 20:51:49 -04:00
mark_story
c6173a0054 Add tests for #3288 and remove nested ternaries.
Nested ternaries are complicated to maintain and hard to read. Break
down the nested ternary into two conditionals.
2014-04-10 20:37:08 -04:00
Guillaume Lafarge
db450a96e9 Fix Hash type casting
When using comparison with a boolean, as the filter is a string, we have to convert the data boolean to "boolean string" to avoid type-casting troubles.

## Example
```php
$users = [
    [
        'id' => 2,
        'username' => 'johndoe',
        'active' => true
    ],
    [   'id' => 5,
        'username' => 'kevin',
        'active' => true
    ],
    [
        'id' => 9,
        'username' => 'samantha',
        'active' => false
    ],
];
$unactiveUsers = Hash::extract($users, '{n}[active=false]');
print_r($unactiveUsers);
```

This example returns the two unwanted active users because `"false"` is `true` but not `false` :)

I think this pull request will fix this issue by converting true/false boolean to string (to match with our filter).
2014-04-10 20:19:32 +02:00
euromark
c321ee5fec correct doc block 2014-04-09 03:07:19 +02:00
Mark Story
bb7b450404 Merge pull request #3260 from dereuromark/2.5-count-dim
Without any params this method does not make sense
2014-04-07 21:45:31 -04:00
euromark
fdc42a24ca Without any params this method does not make sense 2014-04-08 03:27:45 +02:00
euromark
a7744e6ff4 a few more corrections 2014-04-08 01:49:33 +02:00
euromark
0ece694a75 microptimize options and default merge and other string key array merges 2014-04-08 01:25:14 +02:00
Jose Lorenzo Rodriguez
343d3279b9 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Test/Case/Utility/FileTest.php
	lib/Cake/VERSION.txt
2014-04-06 21:50:41 +02:00
euromark
854a53b3cb generalize sentence 2014-04-04 19:19:10 +02:00
euromark
823909603a correct deprecation notices 2014-04-04 19:18:02 +02:00
mark_story
8acb75425d Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Datasource/DboSource.php
2014-03-21 22:55:28 -04:00
wbkostan
9a36ed5785 Update Inflector.php
Modified singularizer inside inflector to accurately inflect most words ending in -aves. Removed irregular cases solved by this fix.
2014-03-19 19:12:44 -04:00
mark_story
c5b6dda82f Merge branch 'master' into 2.5 2014-03-11 21:02:27 -04:00
Jorge González
4d51092259 fixing Set docblocks 2014-03-08 10:26:03 +00:00
Jorge González
6049009cac improving docblock for Set::extract and Set::classicExtract return types 2014-03-07 19:33:02 +00:00
mark_story
0f584c0e8b Merge branch 'master' into 2.5 2014-02-24 21:19:17 -05:00
AD7six
4e0627232c account for localized floats more robustly.
Normalize floats, strings too, so that they are validated as

    dddddddddd.dd

ref #2853
2014-02-19 15:04:25 +00:00
mark_story
b8c94fa5d4 Merge branch 'master' into 2.5 2014-02-18 22:19:12 -05:00
mark_story
0a51458ffd Fix Validation::decimal() not working with localized floats.
Use similar workarounds as DboSource::value() for accepting localized
floats.

Fixes #2853
2014-02-18 22:18:56 -05:00
Mark Story
c325a93998 Merge pull request #2741 from ADmad/2.5-mimetype
Added regex support to Validation::mimeType().
2014-02-17 10:10:48 -05:00
ADmad
9ae7f11a2a Made mimetype check case insensitive. 2014-02-17 11:48:00 +05:30
mark_story
7a4cabe5d3 Add depth to log().
Much like dump() it is handy to be able to control the depth variables
are dumped out when logged.

Refs #2834
2014-02-16 14:35:32 -05:00
mark_story
2c5d96e916 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
2014-02-16 14:24:19 -05:00
José Lorenzo Rodríguez
4f424007fa Merge pull request #2822 from dereuromark/master-validation
Fix uploadError validation rule
2014-02-13 19:58:40 +01:00
ADmad
54a395cc3e Updated docblock.
BlowfishAuthenticate is deprecated.
2014-02-13 17:54:53 +05:30
euromark
1725386c16 Fix uploadError validation rule to work with OS Win. Here the error is string, not integer. 2014-02-12 21:52:18 +01:00
mark_story
a5d50da040 Remove dead and unused code. 2014-02-11 16:38:24 -05:00
ADmad
9de3418079 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Permission.php
2014-02-11 18:17:59 +05:30
Eric Martins
2793dca671 Fix ApiGen errors 2014-02-07 18:29:54 -02:00
ADmad
2d10707d18 Added regex support to Validation::mimeType(). 2014-01-30 21:05:04 +05:30
mark_story
75dd2ff1fb Merge branch 'master' into 2.5 2014-01-16 15:20:40 -05:00
Christian Winther
ace586e367 Merge pull request #2656 from makusu/fix-debugger-templates-array
fix multiple log array key definition on templates property in Debugger
2014-01-14 23:29:05 -08:00
Max Meiden Dasuki
9cc7c465d1 fix multiple log array key definition on templates property in Debugger 2014-01-15 15:14:00 +08:00
Bryan Crowe
cd27012405 Simple docblock updates to CakeTime 2014-01-08 21:38:45 -05:00
mark_story
99e4dbd827 Merge branch 'master' into 2.5 2013-12-23 11:58:07 -05:00
Saleh Souzanchi
328125ad43 Merge branch 'master' into master-phpcs-error-fix 2013-12-23 11:43:54 +03:30
Mark Story
321347e52b Merge pull request #2532 from bar/patch-2
Trivial continue.

fix phpcs error "Missing @throws tag in function comment"
2013-12-23 11:21:18 +03:30
mark_story
62e89734ab Throw exceptions from Hash::combine()
When the key + value counts do not match Hash should throw an exception.
Silently doing the wrong thing is generally not a good idea. While this
change could break existing applications, those applications were
probably behaving incorrectly anyways.

Fixes #2470
2013-12-21 17:46:05 -05:00
José Lorenzo Rodríguez
60d2ece035 Merge pull request #2506 from dereuromark/2.5-string
Correct tokenize for empty strings.
2013-12-21 10:31:52 -08:00
mark_story
7e5c0f7185 Merge branch 'master' into 2.5 2013-12-20 14:15:35 -05:00
euromark
3ecce19732 Correct tokenize for empty strings. 2013-12-19 15:58:08 +01:00
Mark Story
ca2fb6fcfc Merge pull request #2503 from dereuromark/master-string
Correct doc block
2013-12-18 09:27:00 -08:00
euromark
3100118a4e Correct doc block 2013-12-18 12:10:23 +01:00
mark_story
44b7d013ae Fix whitespace error. 2013-12-16 21:39:06 -05:00
ADmad
8a666fb37e Don't throw exception when trying to encrypt falsey value. 2013-12-15 19:28:56 +05:30
mark_story
ef899f0c93 Make API docs easier to read. 2013-12-14 23:08:07 -05:00
mark_story
47497029bb Fix mixed tabs/spaces. 2013-12-14 23:03:34 -05:00
mark_story
e15d1652ed Relax the 'my' and 'ym' date validation formats.
All other formats that include 'y' allow 2006 or 06. These formats are
now conformant with the other formats available.

Closes #2436
2013-12-14 23:02:12 -05:00
mark_story
15c390586f Pull out some re-used subpatterns.
Having smaller segments makes reading the larger patterns simpler, and
allows for less duplication across the various patterns.

Refs #2436
2013-12-14 18:20:20 -05:00
mark_story
c2b8778ce8 Merge branch 'master' into 2.5 2013-12-14 17:45:49 -05:00
mark_story
79701af501 Make Hash::numeric() accept more numeric things.
Negative numbers and other stringy forms of numbers should be accepted.
The name Hash::numeric implies is_numeric which it now uses.

Fixes #2478
2013-12-12 17:41:38 -05:00
Gombos Lorand
764e368dc3 Check if the item is an array. 2013-12-05 12:03:07 +02:00
mark_story
430ef88118 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/VERSION.txt
2013-11-25 23:15:15 -05:00
mark_story
37e387fed2 Replace non-breaking spaces with Inflector::slug().
Fixes #2363
2013-11-22 10:13:10 -05:00
ADmad
dda6080579 Merge branch 'master' into 2.5 2013-11-19 00:27:12 +05:30
Marc Würth
229bd69903 Added link to three hash methods 2013-11-17 03:40:39 +01:00
mark_story
cee2801700 Add 'metadata' to the uninflected list.
Fixes #2332
2013-11-15 21:49:05 -05:00
Marc Würth
7cfa0116f4 Removed "PHP 5" from file header DocBlocks
This statement does not serve a purpose anymore.
In a long forgotten world it indicated the main version number of PHP which the code in the file was compatible to.
http://pear.php.net/manual/en/standards.sample.php
But since PHP 5.1 and later this is only marginally true.
Thus I propose to remove it from CakePHP.
2013-11-13 22:58:39 +01:00
Kim Egede Jakobsen
18e0dc95dd Remove @return from docblock (for __construct && __destruct methods) 2013-11-11 14:54:48 +01:00
mark_story
3c1f775ab2 Merge branch 'master' into 2.5 2013-11-09 09:37:27 -05:00
mark_story
ada0ec4c77 Fix formatting of decimal values when there is no fractionSymbol.
When a currency format does not include a fractionSymbol it should be
able to format fractional values.

Fixes #2253
2013-11-09 09:36:38 -05:00
davidsteinsland
e68a61c375 Added configurable default value to Hash::get() 2013-10-31 23:31:48 +01:00
mark_story
aaac360833 Merge branch 'master' into 2.5 2013-10-30 14:58:20 -04:00
Mark Story
d6f5f2f0bb Merge pull request #2244 from dereuromark/2.5-debugger
Pass depth through for Debugger::dump().
2013-10-30 11:26:28 -07:00
euromark
fecbef5949 Pass depth through for Debugger::dump(). 2013-10-30 18:31:48 +01:00
Bryan Crowe
507bb44301 Update date comparisons to be strict in CakeTime 2013-10-29 23:02:14 -04:00
Bryan Crowe
00c5e88570 Make use of timezone parameter in CakeTime::dayAsSql() 2013-10-29 20:29:01 -04:00
ADmad
d9ca148499 Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Model.php
	lib/Cake/VERSION.txt
2013-10-30 02:34:09 +05:30
Phally
9260a78ea3 Fixes last items for #1665.
- Changes double quotes to single quotes.
- Documents and tests array-based string replace.
- Rewrites test case.

Rewrites the test case because the tests didn't work as well as
they should be. The test file copied itself to the tmp directory,
did some string replace stuff on it and then loaded the data to
test its contents. However in those contents were also the
expectations, so assertContains() would always see the string in
the file... even if the replacing didn't work.

Closes #1665.
2013-10-26 14:50:42 +02:00
rooseveltrp
98e11cea5d Adds File::replaceText().
Added File::replace()

Searches for a given text and replaces the text if found

Renamed File::replace() to File::replaceText()

Updated the replaceText() method to utilize File Locking

Updated File::replaceText()

1. Method now checks if the lock is not identical to null
2. Since the method uses File::read() to get the contents of the file,
there is no need for a temporary file. Removed the temporary file
creation

File::replaceText() update

Opening file with r+ mode
2013-10-26 14:05:12 +02:00
Bryan Crowe
a943ea5c34 Add space between classname(s) 2013-10-22 22:59:50 -04:00
Bryan Crowe
d39ced8381 Correct 'an URL' to 'a URL' in docblocks 2013-10-22 00:09:34 -04:00
euromark
c08df2a7f9 Correct wording of Hash::expand() 2013-10-19 17:54:43 +02:00
mark_story
1ae470a284 Fix inflection rules for curves.
Remove curve from the uninflected list and update rules so it, wolves,
and lives are still properly handled.

Fixes #2148
2013-10-17 12:15:56 -04:00
mark_story
5a394c379a Merge branch 'master' into 2.5 2013-10-14 22:57:50 -04:00
euromark
ed2054f4f2 Allow international domains to pass validation. Fixes #1763 2013-10-13 23:43:29 +02:00
Jose Lorenzo Rodriguez
df549898ad Merge remote-tracking branch 'origin/2.5' into k-halaburda-master 2013-10-12 01:05:02 +02:00
mark_story
5aa8a458b1 Update UUID pattern to accept the 'nil' UUID.
Fixes #4133
2013-10-10 21:11:55 -04:00
Bryan Crowe
81c2e9db84 Capitalize UUID acronym 2013-10-08 21:46:30 -04:00
mark_story
60b0893c79 Merge branch 'master' into 2.5 2013-10-06 23:49:32 -03:00
Bryan Crowe
8895405577 Rrue to True, simple typo 2013-10-04 02:06:32 -04:00
Bryan Crowe
c729b56b23 Additional grammatical corrections to File utility 2013-10-04 02:03:53 -04:00
Bryan Crowe
79c3336b7e Updated returns in docblocks in File utility 2013-10-03 20:40:00 -04:00
Bryan Crowe
0cffcd1eca Added missing semi-colon in return 2013-10-02 22:55:09 -04:00
Bryan Crowe
b9003e5f7c Allow Folder::addPathElement() to accept arrays, also corrected docblock 2013-10-02 22:45:22 -04:00
Renan Gonçalves
a73e926467 Make String::wrap() unicode aware. Solves #3981. 2013-10-01 22:35:11 +02:00
mark_story
5e9b22271a Merge branch 'master' into 2.5 2013-09-27 22:26:33 -04:00
Bryan Crowe
bb65765d70 Updated additional references of Cake to CakePHP 2013-09-27 21:31:35 -04:00
euromark
df269ba0ef Cake to CakePHP name 2013-09-27 19:36:43 +02:00
mark_story
cc5795c67d Merge branch 'master' into 2.5 2013-09-26 10:07:10 -04:00
Mark Story
ce9f547175 Merge pull request #1655 from dereuromark/2.5-inlist-clean
2.5 inList(), multiple() and case sensitivity
2013-09-25 11:45:29 -07:00
euromark
0ae69aace9 App::import to App::uses 2013-09-25 19:40:14 +02:00
Bryan Crowe
7d7954ce18 Replaced all is_a() calls with instanceof operator 2013-09-24 21:08:06 -04:00
euromark
f7e507145c Case insensitive validation inList option. Resolves ticket 3521. Added two tests to proof the faulty behavior of $strict here. Also address the faulty behavior in multiple() and replace it with case sensitivity. 2013-09-24 02:01:50 +02:00
mark_story
d2577fac60 Merge branch 'master' into 2.5 2013-09-21 20:01:50 -04:00
mark_story
a30f861f2c Use array_key_exists instead of isset()
This allows contains() to work with null values.

Fixes #4083
2013-09-19 21:44:09 -04:00
Bryan Crowe
5c329b4875 Updated CakeTime::i18nFormat() doc block description 2013-09-17 23:09:46 -04:00
mark_story
a7a6fcae8a Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/VERSION.txt
2013-09-17 10:11:24 -04:00
euromark
e3a3946e89 address casting cs 2013-09-17 15:15:25 +02:00
euromark
12f2f729c8 more cs 2013-09-17 14:53:07 +02:00
euromark
382f75dbfc cs corrections, bool to boolean and int to integer. 2013-09-17 14:44:34 +02:00
mark_story
7379d32b59 Simplify & fix phone number validation.
The changes made in fa3d4a0bb5 tightened
the area code validation too much and excluded at least one valid area
code. This change replaces that with a more generic solution that does
not attempt to exclude non-allocated but potentially valid area codes.

Fixes #4066
2013-09-13 23:05:40 -04:00
ADmad
c27aa99af9 Merge branch 'master' into 2.5 2013-09-08 20:36:40 +05:30
euromark
959988cfa1 Remove last yoda conditions as per coding standards guidelines. 2013-09-06 18:36:57 +02:00
mark_story
f22c4cf90b Merge branch 'master' into 2.5 2013-09-05 10:21:41 -04:00
Schlaefer
82da8d9d07 performance improvements in CakeTime::timeAgoInWords Edit
- rearranges code to move return statements before otherwise dead code
- only do translation if translated string is actually used
2013-09-05 12:22:28 +02:00
Rob McVey
7f44cc01b5 Plural of breif is breifs not breives 2013-09-04 09:20:32 +01:00
mark_story
4c92cdcada Reorder inflection rules.
Place rules for words like 'archives' and 'relatives' before words like
'knives'.

Fixes #4040
2013-09-03 12:50:02 -04:00
mark_story
59bb05b433 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/VERSION.txt
2013-09-02 11:35:09 -04:00
mark_story
13b870d7e1 Fix coding standards error. 2013-09-01 21:44:45 -04:00
José Lorenzo Rodríguez
fec646b69f Merge pull request #1588 from kimegede/caketime-docblock-update
Added @link CakeTime.
2013-08-31 21:59:11 -07:00
Kim Egede Jakobsen
539040aa07 Added @link CakeTime. 2013-08-31 21:56:15 -07:00
Kim Egede Jakobsen
fcf9f34392 Added @link to CakeNumber's docblock 2013-08-31 17:32:48 -07:00
Kim Egede Jakobsen
46d3d8e48e Added @link to all public functions there have documentation.
And correct a small 'typo'.
2013-08-31 17:12:29 -07:00
mark_story
95ad5f5c78 Add hmac to encrypted data.
Using an HMAC ensures that the ciphertext has not been
modified.
2013-08-29 14:40:01 -04:00
mark_story
c5092851d1 Fix compatibility with PHP 5.2 2013-08-27 23:03:08 -04:00
mark_story
215d43eb06 Add encrypt() and decrypt() methods.
These methods use AES-256 and provide a simple to use API with easy to
remember names.
2013-08-27 21:20:22 -04:00
mark_story
f655e8a7bc Minor simplification. 2013-08-24 21:49:17 -04:00
Chen Cohen
a0014e7a30 Ticket 4011 - Adding matchers support for Hash::remove() and Hash::insert() 2013-08-24 02:02:01 +03:00
euromark
361980fade remove code, class names and paths from translation strings. 2013-08-21 00:05:53 +02:00