Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added some code examples in installation userguide. #256

Closed
wants to merge 292 commits into from
@diogotozzi

Added code examples for better understanding in installation userguide.

samsoir and others added some commits
@samsoir samsoir Fixes #4276, illegal offset error is now fixed aa64b97
@samsoir samsoir Refs #3536, tidyed up redundent parameters not required in 3.2 reques…
…t client internal execution
d8a36f6
@acoulton acoulton Fix bug introduced by 5b8159f fixing Arr::map callback syntax - fixes…
… #4259
7ec1d82
Jordan Thomas Add additional irregular pluralizations to inflector config. Remove e…
…ntries handled by inflector logic. Addresses #4322.

Adds:
- appendix
- cactus
- calf
- crisis
- criterion
- curriculum
- diagnosis
- elf
- ellipsis
- foot
- hoof
- hypothesis
- knife
- life
- loaf
- nucleus
- oasis
- octopus
- paralysis
- parenthesis
- phenomenon
- potato
- quiz
- radius
- scarf
- stimulus
- syllabus
- synthesis
- thief
- tooth
- wharf
- wife

Removes:
- clothes
- course
- expense
- movie
- purchase
- size
- verse
f2a83a1
@cbandy cbandy More Arr::merge() tests bc5102c
@cbandy cbandy Handle indexed arrays consistently in Arr::merge(). Fixes #3141 22e96d3
Spider Fixed bug with incorrect mime type 3bc535e
@shadowhand shadowhand Check the type of $message in Validation::errors() to prevent issues …
…when a field name and rule are the same, fixes #4365
fe38fe9
@shadowhand shadowhand Merge pull request #183 from stillman/3.2/develop
Send the correct mime type when sending files, fixes #4344
e6ed617
@shadowhand shadowhand Merge pull request #186 from shadowhand/3.2/issue/4365-validation-mes…
…sage-type-checking

Check message type in Validation::errors(), fixes #4365
cbd340b
@kiall kiall Add a action execution wrapper. Refs #4271 72258b7
@kiall kiall Update action wrapper per feedback. Refs #4271 6b7ae2a
@kiall kiall Merge pull request #188 from kohana/3.3/feature/4271-ActionWrapper
Merge pull request for #4271
dc43fd3
@kiall kiall Fixes #3178 - "Kohana Exception's hide $previous".
First PHP 5.2 compatibility break.
e36c698
@kiall kiall Merge pull request #177 from jordanthomas/3.1/develop
Add additional irregular pluralizations to inflector config
a0b6348
Jordan Thomas Add additional irregular pluralizations to inflector config. Remove e…
…ntries handled by inflector logic. Addresses #4322.

Adds:
- appendix
- cactus
- calf
- crisis
- criterion
- curriculum
- diagnosis
- elf
- ellipsis
- foot
- hoof
- hypothesis
- knife
- life
- loaf
- nucleus
- oasis
- octopus
- paralysis
- parenthesis
- phenomenon
- potato
- quiz
- radius
- scarf
- stimulus
- syllabus
- synthesis
- thief
- tooth
- wharf
- wife

Removes:
- clothes
- course
- expense
- movie
- purchase
- size
- verse
03a4af5
Jordan Thomas Add additional irregular pluralizations to inflector config. Remove e…
…ntries handled by inflector logic. Addresses #4322.

Adds:
- appendix
- cactus
- calf
- crisis
- criterion
- curriculum
- diagnosis
- elf
- ellipsis
- foot
- hoof
- hypothesis
- knife
- life
- loaf
- nucleus
- oasis
- octopus
- paralysis
- parenthesis
- phenomenon
- potato
- quiz
- radius
- scarf
- stimulus
- syllabus
- synthesis
- thief
- tooth
- wharf
- wife

Removes:
- clothes
- course
- expense
- movie
- purchase
- size
- verse
eedefa1
Zbigniew Motyka Converting method Arr::extract to work with paths not keys. Fixes #4371 cad88a9
@kiall kiall Add tests for Arr::extract() via paths. Tests #4371. 72567e2
@kiall kiall Merge pull request #189 from kohana/3.3/feature/4371-extract-paths
Fixes #4371 - Merge "Arr::extract() with paths"
a94e45d
@kudos kudos Fixes #4291, checks for PHP 5.4 before doing get_magic_quotes_gpc as …
…it has been deprecated.
acf8ff0
@kudos kudos Fixes #4291, checks for PHP 5.4 before doing get_magic_quotes_gpc as …
…it has been deprecated.
c17dab7
@AlexC AlexC Changed usage of $_POST to Request::post() in guide documentation. Fi…
…xes #4256.
42f5b7e
@kiall kiall Merge branch '3.2/develop' into 3.3/develop 2c89783
@kiall kiall Refs #4374 / Refs #4373 - Return a Response from Controllers and Clea…
…nup Request Isolation / Exception Handling.
669f385
@samsoir

a return value isn't really required, but won't hurt I guess

Agreed, Its not strictly necessary but does no harm..

kiall and others added some commits
@kiall kiall Refactor Exception -> View conversion and reinstate correct exception…
… handling for sub requests. Refs #4373
0b7471a
@kiall kiall Remove stray debugging output. f5481e7
@kiall kiall Fixup exception handling from outside the initial Request_Client_Inte…
…rnal::execute() invocation. Refs #4373
b9b6f7d
@kiall kiall Fixup HTTP_Cache. Refs #4374. 03b569a
@kiall kiall Move Response::check_cache() to HTTP class. Refs #4373. 5b9bd8e
@kiall kiall Introduce the notion of `HTTP_Exception_Expected` and `HTTP_Exception…
…::get_response()`. Refs #4377.
1440b6a
@kiall kiall General cleanup of the Kohana_Exception class. Refs #4377. a6ee21a
@kiall kiall Add HTTP_Exception_Redirect to house common code for redirections. Re…
…fs #4377
f2eca6f
@kiall kiall First stab at documentation for #4373, #4374, #4375 and #4377.
Refs #4373 / Refs #4374 / Refs #4375 / Refs #4377
dca0a3c
@kiall kiall Fixup some bugs in the previous commits + Add a HTTP_Exception::reque…
…st() method.
fd8e3af
@kiall kiall Add class-level docblock to HTTP_Exception_Expected and HTTP_Exceptio…
…n_Redirect. Refs #4377 and #4375.
cc0beff
@kiall kiall Expand on docs for custom error pages. Refs #4377. 76d51af
@kiall kiall Update occurrences of 3.2 in the docs to 3.3. b9c5737
@kiall kiall Removed unused variable "Kohana::$log_errors" 9743e42
@kiall kiall Merge remote-tracking branch 'origin/3.3/develop' into 3.3/feature/Re…
…questResponseCleanup
15824ce
@kiall kiall Fix environment comparison operator in docs. Refs #4377. 15329a3
@kiall kiall Use XDebug to provide stack traces for fatal errors if available. Fix…
…es #4020.
f86c9b8
@kiall kiall Enable XDebug parameter collection in development. Refs #4020. 0397372
@kiall kiall Merge pull request #160 from acoulton/bug/4259-syntax-for-arr-map
Clarify syntax for passing array callbacks to Arr::map. Fixes #4259.
814b2b8
@acoulton acoulton Clarify syntax for passing array callbacks to Arr::map - fixes #4259 f3e64d0
@acoulton acoulton Fix bug introduced by 5b8159f fixing Arr::map callback syntax - fixes…
… #4259
a7b5ba4
@kiall kiall Merge pull request #146 from mintbridge/patch-1
Fixing typo in Doc block for Valid::alpha_numeric() Test
881a979
@mintbridge mintbridge Fixing typo in Doc block for Valid::alpha_numeric() Test 02542a7
@Ikke Ikke Arr::get() uses array_key_exists now in stead of isset. Fixes #4012 76f6e4c
@Ikke Ikke Change arr::get so that it fixes #4012 and still work with ArrayAccess
ArrayObjects with STD_PROP_LIST don't work together with
array_key_exists. These tests test if arr::get still works with
ArrayObjects.

arr::get now additional checks if the array is an ArrayAccess object and
uses the offsetExists() method to check if the key exists.
0128655
@Ikke Ikke Fix tab/space problem 1041448
@Ikke Ikke Add missing argument in example for Upload::Image() 12f2742
@shadowhand shadowhand Merge pull request #191 from Ikke/3.3/fix-4297
3.3/fix 4297
c518ba3
@parshap parshap Decouple session data serialization 43804ad
@shadowhand shadowhand Merge pull request #94 from simshaun/3.2/develop
3.2/develop
193deb0
@zombor zombor Remove all instances of `cli` from kohana-core, Refs #3989 85c00aa
@kiall kiall Remove reamining CLI test. Refs #3989 ddb166d
@kiall kiall Merge branch '3.3/develop' into 3.3/feature/RequestResponseCleanup c8c8c7f
@kiall kiall Remove tests that no longer apply. aa68cd6
@kiall kiall Remove calls to Request::create_response() from the tests. Refs #4374. 7af34d7
@kiall kiall Move HTTP_Cache class to the Cache module. Fixes #4382 18c7a89
@kiall kiall Merge branch '3.3/develop' into 3.3/feature/RequestResponseCleanup
Conflicts:
	classes/kohana/http/cache.php
	tests/kohana/request/client/CacheTest.php
1ea4fe2
@salathe salathe Make Date::formatted_time()'s timezone parameter work even if the inp…
…ut date/time string has a timezone, fixes #3902
09b8fc5
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 111b069
@shadowhand shadowhand Merge pull request #190 from Ikke/3.3/fix-4012
Fixes #4012
7dc2a8e
@shadowhand shadowhand Added Route::filter(), callback support for route matching, refs #4388 af999fb
@shadowhand shadowhand Modified how filter return values are handled in Route::matches(), re…
…fs #4388
3b45789
@shadowhand shadowhand Added tests for Route::filter(), refs #4388 45937d6
@shadowhand shadowhand Merge pull request #196 from kohana/3.3/feature/4388-route-filters
Fixes #4388
a282ef1
@acoulton
Collaborator

I think this makes sense, but it doesn't remove the need to change some indexed config arrays to associative - eg the memcached config that ships with the cache module - as otherwise there is no way to remove or update settings at module or system level.

Indexed arrays should only be used where a module or application developer would never need to remove a value from higher up the tree - which I think is a fairly limited use case anyway?

loguntsov and others added some commits
@loguntsov loguntsov Using closure at validation rule. Change comments and userguide b972911
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 9c58f38
@shadowhand shadowhand Added tests for fe38fe9d426a0d6ac608e63bc0b6e7d71a76fda4, refs #4365 77847ce
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 160011f
@shadowhand shadowhand Moved Request::user_agent() to Text::user_agent(), user agent string …
…can now be provided out-of-band, fixes #3396
3c73235
@shadowhand shadowhand Merge branch '3.1/develop' into 3.2/develop b350db6
@shadowhand shadowhand Use array_merge() instead of += in Arr::flatten(), which causes issue…
…s when flattening indexed arrays, fixes #3326
56aac47
@shadowhand shadowhand Merge branch '3.1/develop' into 3.2/develop 6b11df2
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop d8fcaae
@shadowhand shadowhand Use Arr::path() instead of Arr::get() in Request::query() and Request…
…::post(), fixes #4158
b25d30f
@shadowhand shadowhand Use date_diff() in Date::span() for calculating months, as not all mo…
…nths are 30 days in length, fixes #4194
c9e8d02
@shadowhand shadowhand Added $step parameter to Valid::range(), fixes #4043 23e1b0b
@shadowhand shadowhand Fixed missed CS "OR" value in Kohana::FILE_SECURITY, fixes #4359 57c4566
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 6ad162d
@shadowhand shadowhand Added "releases" to irregular inflector config, fixes #3659 3b44190
@shadowhand shadowhand Merge branch '3.1/develop' into 3.2/develop d9808de
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop c3f8ccb
@shadowhand shadowhand Append, rather than replace, cached routes in Route::cache(). Fixes #…
…4347
73032a6
@shadowhand shadowhand Follow up to 73032a6db0770c68d69abc9635c2f159814deb25, rather than ch…
…anging existing functionality, added a new parameter to Route::cache(). Added unit tests. Refs #4347.
6033b75
@shadowhand shadowhand Remove version-specific references from guide install and menu files,…
… fixes #4351
aa472ab
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 3a01c55
@shadowhand shadowhand Deprecated Request::parse_accept(), refs #4315 dd82393
@shadowhand shadowhand Allow "rel" attribute to be overloaded in HTML::style(), fixes #4283 1f76bf4
@shadowhand shadowhand Added webm content type to config/mimes.php, fixes #3911 324f0fb
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 3bed1ce
@zombor zombor Remove cli check from exception handler, remove exit calls. Refs #3989 24e4c3d
@kiall kiall Merge branch '3.3/develop' into 3.3/feature/RequestResponseCleanup
Conflicts:
	guide/kohana/menu.md
31226d0
@kiall kiall Fixup Request_Client_External. Refs #4374. 7ce1a72
@kiall kiall Remove HTTPTest, It has no tests.. ca05ec9
@kiall kiall Fixup Kohana_Request_Client_Internal test. Refs #4373 c6186dc
@kiall kiall Truncate rather than scrap the stack trace under PHPUnit. Refs #4373 6bc6cf0
@kiall kiall Merge pull request #194 from kohana/3.3/feature/RequestResponseCleanup
Fixes #4377, #4375, #4374, #4373, #4319
0c6854b
@kiall

Should this not be $request->headers('accept') ?

Yes, I suppose it should.

Fixed in f342511.

And also 4713299.

kiall and others added some commits
@kiall kiall Update @copyright notices to 2012. Fixes #4396. af7abfe
@kiall kiall Merge branch 3.1/develop into 3.2/develop 86d2a2c
@kiall kiall Merge branch '3.2/develop' into 3.3/develop
Conflicts:
	classes/kohana/http/cache.php
	tests/kohana/request/client/CacheTest.php
f5f99b4
@kiall kiall Merge branch '3.3/develop' of http://github.com/kohana/core into 3.3/…
…develop
1fcafa4
@kiall kiall Update @copyright notices to 2012. Fixes #4396. f0c2f80
@kiall kiall Merge branch 3.1/develop into 3.2/develop c2d22a9
@kiall kiall Merge branch 3.2/develop into 3.3/develop 196f96c
@shadowhand shadowhand Deprecated Request methods: accept_lang(), accept_encoding(), accept_…
…type(), refs #4315
f342511
@shadowhand shadowhand Follow up to f3425119c7b5cb1a7e49b92730d1c10c0415b155, reference HTTP…
…_Header methods where acceptable, refs #4315
4713299
@mintbridge mintbridge fixing broken links on the main guide page a3ac81a
@shadowhand shadowhand Merge pull request #201 from mintbridge/3.1/issue/4397-guide-broken-l…
…inks

Fixes #4397
2463efe
@shadowhand shadowhand Merge branch '3.1/develop' into 3.2/develop 6f722f3
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 140a88d
@kiall kiall Merge pull request #198 from kohana/3.3/issue/3141-merge-indexed-arrays
#3141 - Handle indexed arrays consistently in Arr::merge(). Fixes #3141.
fa8f218
@kiall kiall Update docs regarding redirects including a note on potential changes…
… before 3.3 is released.
efda553
@badsyntax badsyntax Updated the Clean URLs tutorial to include a short explanation of why…
… the .htaccess file might not be read by Apache
3f5e3e1
@ThePixelDeveloper

This commit breaks the send_file functionality.

The second argument is the download name and usually doesn't exist on the file system. For example, I might serving the file:

/var/www/website.com/public/upload/files/0/000/004/0000004639.jpeg

with the download name as:

user-screenshot.jpeg

The failure comes from File::mime; It tries to load the file to find its mime type. Line 45 of kohana/file.php. This needs to be reverted.

Fixed by e139a64.

@dyron

Sure this is a static method?

Possibly a good point... it would be nice to see it not static and $uri to be replaced with $params (as in Route::uri() params).

Correct, this shouldn't be static. My mistake!

@shadowhand - I'm all for encouraging reverse routing, but how would that work for redirects to external URLs ?

Accept an array or a string. Or require external redirects to use HTTP::redirect().

I'm not sure I like needing to use two methods for internal vs external redirects.

Re reverse routing, it would assume the current route?

Or redirect(302, $route_name_or_uri, $params) (or the last two reversed to default to the current route)?

I'll have a look at what works for this later today.

Owner

I really don't see the point in this method. I also don't think it should implement reverse routing on its own as redirecting has nothing to do with generating a uri.

But really, why does this exist?

At the moment, $this->request->redirect() has the URI as the first parameter and code as the second.
Should the HTTP::redirect() not follow the same order ? Otherwise it will force you to always define a code, even if you want it to be the default 302.

Eg Ideal:
HTTP::redirect("feedback");

Eg Proposed:
HTTP::redirect(302, "feedback");

Plus, it better helps people migrating from 3.1

@davecarlson has a point here... why are we forcing the user to define the code?

is there any more info on if this is going to be corrected for 3.3 ?

Yea - I'll have this sorted today!

great news !

kiall and others added some commits
@kiall kiall Ensure I18n tests work correctly when I18n::$lang has been set to som…
…ething other than en-us.
c8320bb
@kiall kiall Ensure I18n tests work correctly when I18n::$lang has been set to som…
…ething other than en-us.
6b7d050
@kiall kiall Ensure I18n tests work correctly when I18n::$lang has been set to som…
…ething other than en-us.
80d2bc5
@kiall kiall Fixed issue with I18n::lang() test expecting state to be preserved ac…
…ross runs.
cbed05a
@kiall kiall Fixed issue with I18n::lang() test expecting state to be preserved ac…
…ross runs.
c9cc888
@kiall kiall Fixed issue with I18n::lang() test expecting state to be preserved ac…
…ross runs.
dce8cc7
@kiall kiall Fix a bug where, in some cases, the exception handler begins the stac…
…k trace in an unexpected place.
a25b341
@Zeelot Zeelot STD log classes append instead of prepending PHP_EOL (fixes #4418) 00093db
@zombor zombor Merge branch '3.3/feature/3989-Remove-CLI' into 3.3/develop
Conflicts:
	classes/kohana/kohana/exception.php
c7b1986
@zombor zombor Fix previous bad merge 1818309
@shadowhand shadowhand Follow up to 3bc535eb536e54451b722da9699d052c863ac1b4, determine the …
…download mime by the extension rather than the actual download file (which will probably not exist). Refs #4344
e139a64
@Zeelot Zeelot unittest and fix for validation callbacks adding errors manually (fix…
…es #3900)
f876ba5
@Zeelot Zeelot Merge branch '3.2/develop' into 3.3/develop (fixes #4430) 7ae7010
Gabriel Evans Update HTML::attributes tests for 9cffcd9, refs #4412 485acf4
@shadowhand shadowhand Merge pull request #212 from gevans/3.3/feature/4412-empty-attributes…
…-test

Adds tests for HTML::attributes(), refs #4412
3630349
@shadowhand shadowhand Fixed a regression in how global variable references are handled, ref…
…s #2919, refs #3450, fixes #4431
9803c24
@shadowhand shadowhand Merge branch '3.1/develop' into 3.2/develop 64753b7
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop c982079
@stillman

There should be bitwise OR instead of logical

@dyron

Seems broken, can't find the specific commit in 3.3/feature/3989-Remove-CLI.

File an issue on redmine?

Owner

I fixed this botched merge in a later commit. All the tests currently pass for this on the 3.3/dev branch.

@Yahasana

$namespace = ''; is not necessary.

@shadowhand
Owner

This is a perfect example of when CamelCase issues might pop up. I don't think there is a good solution for it, other than documentation.

@Yahasana

should be if ( ! empty($params['controller']))

Agreed.

@kemo
Collaborator

finally, the ugliest line(s) in Kohana code :P

Agreed! But a cleaner diluting without a foreach wasn't forthcoming!

Solution* damn auto correct!

Wait, why is this still using if (array_key_exists(...))? It should be if (! empty(...)). There's no value in doing string operations on an empty string.

@shadowhand - ah yes. I completely forgot about that suggestion.

I won't be back at an actual computer until tomorrow, if you don't get to it beforehand I'll get it changed then.

@kiall Cleaned up in 5b8db1e to prevent the suggestion from being lost.

@Yahasana

Kohana::$log instanceof Kohana_Log is much more accurate

Using Kohana::$log instanceof Kohana_Log would break some of the features of the CFS.

Kohana::$log instanceof Log is completely correct.

Please think about it twice. it doesn't break any thing but promises Kohana::$log is instance of Kohana_Log.

if someone drop a log.php in application/classes, which will break the Kohana system.

<?php
class Log {
    // foo
}

For a while during the 3.1 cycle - I had nearly exactly that.

class Config { 
   // My 100% replaced, but API compatible, config class.
}

That ability to do that is a feature of Kohana.

Oh, it's a good feature. however the customize class has to keep 100% API compatible as you do.
as I never try to 100% replaced Ko's classes, I miss this kind of feature. thanks

@Yahasana

Kohana::$config instanceof Kohana_Config

As above..

@kemo
Collaborator

shouldn't the total amount of characters include the length of end char?

It didn't before, I don't see a reason to change that.

Collaborator

@shadowhand I agree with that if this won't be merged into 3.2, otherwise 2 additional characters will brake things

This is only part of 3.3 and will not be merged into 3.2.

Owner

Did we really need to do this? Any font or IDE that cannot render an ellipsis, which is the only valid character here, needs to be thrown out the window.

Well … would have been preferable to the actual character, but I understand that you don't know how you will be rendering the output so three periods is fine by me.

Have to agree with @Zeelot here! … is the correct character to use! This should be reverted IMO

Also - I've often had graphic designers insist on &hellip; which I would now have to manually try and convert from 3 periods rather than letting htmlentities take care of it!

Where were you guys when the pull request was being discussed?! Reopen the ticket if you want to see this reverted.

Apologies :) Honestly, I saw the email for the original ticket and just assumed someone would reject it! Will re-open it for discussion now...

@visualfanatic

Shouldn't be Kohana_Exception?

Completely correct! Not sure how I managed that!

Thanks

shadowhand and others added some commits
@shadowhand shadowhand Revert "Merge pull request #221 from thinkclay/3.3/develop"
This reverts commit 0055c46badbb846f4dd9fb80abada6749dc0c510, reversing
changes made to c5c45ac6a8b09ee5925c6f94df521f66dc84c0d8.

refs #4450
13dd238
@kemo kemo Refs #4414: Add Facebook user agent to robots config a21882a
@kemo kemo Refs #4465: Response::generate_etag() is failing to check body 05ea261
@shadowhand shadowhand Merge pull request #228 from kemo/3.2/develop
fixes #4414, fixes #4465
01518e1
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop bab30d6
@shadowhand shadowhand Merge pull request #220 from deeceefar2/3.2/develop
fixed bug in Kohana::init() documentation
03c4cbd
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop ead576e
@shadowhand shadowhand Merge pull request #209 from AlexC/3.2/develop
Cleanup syslog, fixes #4284
0c47ecb
@shadowhand shadowhand Merge pull request #205 from awellis13/3.2/develop
IDE comment fix
12837cb
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop
Conflicts:
	classes/Kohana/Request.php
d8a6e9a
@acoulton acoulton Use property accessors rather than internal fields in Kohana_Request_…
…Client for extensibility [refs #4353]
58eda47
@kiall kiall Merge pull request #223 from acoulton/3.3/feature/4353-FollowRedirects
Refs #4353 - strict_redirect option and tests
a4ea876
@acoulton acoulton Resend request body when following redirects other than GET [refs #4353] 98451eb
@acoulton acoulton Refactor Kohana_Request_ClientTest for more powerful mocking [refs #4…
…353]

Implement a dummy controller and route to allow test cases to execute internal
requests and specify controller response through the URL. Provides more
flexibility than mocking the Request/Request_Client and allows for nested
requests.
90bc6d6
@acoulton acoulton Request_Client triggers callbacks on presence of specified headers [r…
…efs #4353]

Request_Client checks the server response and triggers user-definable callbacks
when specified headers are present. The existing logic for following redirects
is implemented as a callback - other uses would include for eg dealing with
a WWW-Authenticate header to refresh an OAuth token.

Callbacks can return a request (which will be executed with the same callbacks
and client parameters as the original request) or a response.
a8a1505
@acoulton acoulton Request callbacks are protected from too much recursion [refs #4353]
Request_Client takes a max_callback_depth property (default 5) and tracks
how many requests have been triggered by header callbacks - if the request
has too much recursion (eg an infinite redirect) the request is aborted with
a Request_Client_Recursion_Exception to allow this case to be handled by the
application developer.
ab62bf5
@acoulton acoulton Request_Client::callback_params() carries arbitrary data for header c…
…allbacks [refs #4353]

Request_Client::callback_params() provides a simple key-value store for
parameters that should be passed on to header callbacks. Parameter values
are copied into sub-requests triggered by a callback.
4e00844
@acoulton acoulton Document Request_Client header callbacks [refs #4353] 8ae2094
@acoulton acoulton Request_Client counts callback_depth from 1 for clarity [refs #4353]
callback_depth now begins at 1 (for the original request) rather than
zero. The property value is therefore directly equivalent to the number
of requests executed. For eg, after a standard request - redirect - request
pair, callback_depth will be equal to 2. The recursion limiting test case
has been updated to independently verify that the correct number of
requests were executed before the exception was thrown.
62335a6
@kiall kiall Strip out the first trace element from logged stacktrace. 1cc79c1
@kiall kiall Merge branch '3.3/develop' of http://github.com/kohana/core into 3.3/…
…develop
502e67e
@Zeelot Zeelot removing Route::$_callback as that is now handled by filters (refs #4…
…209, refs #4388)
0469530
@kemo
Collaborator

I like the idea of passing a Route object to this method but dislike passing Route parameters through it. So:

$this->redirect(Route::get('foo'), 302);

or

$this->redirect($route);

should recognize that URI should be extracted from that route. IMHO passing route params shouldn't go through redirect() but by adding the uri() call to that route, which will return a valid string URI anyways (as it currently does):

$this->redirect(Route::get('foo')->uri(array('bar' => 'fubar')), 302);

The only "concern" I have about redirection is following internal URIs using the new request client: if 302 is returned on POST, will that new URI be POSTed to by default?

Edit:
On the second thought, URL::site() is the one that should be able to accept (internal) Route objects.

@dyron

What's about type hinting public function __construct($uri, array $client_params = array(), .... or/and type casting $client_params = (array) $client_params?
If you expect an array, you should throw a warning instead of discarding it silently.
One the other hand since $client_params is passed to Request_Client_Internal it could handle the type juggling?

Owner

I think I agree (I initially didn't want to change what was written) but maybe it was done to allow NULL to get to the other params. I think I would like to simply do public function __construct($uri, array $client_params = NULL, .... and then remove the is_array() check for a simple (array) typecast.

I actually had the hint initially, but there was an issue with doing that..

Honestly - I'm struggling to remember exactly what that issue was, but it's there!

Owner

Ok I don't think it's a big deal. Since we are so close to the 3.3 release, I would rather leave this as is and take a look at cleaning it up afterwards.

@biakaveron

this should be a "$return Request|HTTP_Exception", I think (returns $this->_request or $this)

phpguru and others added some commits
@phpguru phpguru Wrote the encryption page of the docs using markdown 5e6b709
@kiall kiall Merge pull request #229 from acoulton/3.3/feature/4353-FollowRedirects
Fixes #4353 - Thanks @acoulton!
46b0662
@shadowhand shadowhand Merge pull request #232 from phpguru/5e6b709ad6d4cd263519cd1e4febc314…
…f14460e5

New Kohana 3.2 Guide page on Encryption, fixes #4480
743aebb
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 232640b
@kemo kemo Refs #4375: redirect() parameter order 0a826ab
@kemo kemo Refs #4320 - Remove format parameter from Feed::create() fe4bfa4
@kemo kemo Refs #4375: redirect() parameter order a2a196f
@shadowhand shadowhand Merge pull request #233 from kemo/3.3/develop f15dd11
@kemo kemo Refs #4375: redirect() parameter order fc8ecf0
@kiall kiall Add test for HTTP::redirect(). Refs #4375. 0f149bc
@kiall kiall Merge branch '3.3/develop' of http://github.com/kohana/core into 3.3/…
…develop
0cdf52b
@kiall kiall Merge commit '0f149bcea7a3b099eb646d7d6a4be6f61e57ce65' into 3.3/develop 95fefc2
@kiall kiall Ensure HTTP_Redirect will only accept redirect HTTP codes. fa49803
@mintbridge mintbridge adding an explanation of PSR-0 support of file naming conventions, Re…
…fs #4001
7956a21
@zombor zombor Merge pull request #234 from mintbridge/3.3/feature/PSR-0-guide
Adding PSR-0 support to upgrading guide
1fa9368
@kemo kemo Refs #4236: Use Request client for XML requests e9fb6cc
@kiall kiall Fixes #4489 - Update to auto_load method to take a $directory parameter. 670e9af
@kiall kiall Merge pull request #235 from kemo/e9fb6cc3a2
Feed fixes. Fixes #4320 and #4236.
c0b0289
@kiall kiall Merge pull request #129 from czukowski/bug/4019-injected-routes-are-n…
…ot-taken-into-account

#4019: Injected routes are not taken into account for initial request
7c7c21b
@kiall kiall Merge branch '3.1/develop' into 3.2/develop d3a637a
@kiall kiall Merge branch '3.2/develop' into 3.3/develop 751e283
@thinkclay thinkclay Fixing formatting inconsistencies 6201090
@kiall kiall Merge pull request #237 from arraecreative/3.3/develop
Fixing formatting inconsistencies
6e66190
@dpde dpde Fixed a little misspelling 33b6425
@kiall kiall Merge pull request #241 from dpde/3.3/develop
Fixed a misspelling in the upgrade guide
8b75004
@mintbridge mintbridge fixing typo in email validation message 7fd6288
@kiall kiall Merge pull request #242 from mintbridge/patch-1
Fixing typo in email validation message
6b5de06
@randomecho randomecho capital kohana in text; fixing possessive typo; need comma before exa…
…mple
7f66ff5
@shadowhand shadowhand Merge pull request #243 from randomecho/3.3/develop
Docs update: Configuration in core/system guide
ab33556
@randomecho randomecho casing and possession of abbreviations; grammar and tense 6fb20de
@shadowhand shadowhand Merge pull request #244 from randomecho/3.3/develop
Docs edit: Bootstrap & Upgrading core/system guides
8b8a4ba
@jerfowler jerfowler Normalized Accept-Language header (IE9) - Fixes #4502 d286b13
@jerfowler jerfowler Fix test data error f4b63b9
@shadowhand shadowhand Merge pull request #245 from jerfowler/3.2/develop
Normalize the Accept-Language header
96da868
@shadowhand shadowhand Merge branch '3.2/develop' into 3.3/develop 1cd79e3
@yakatz yakatz Passes CodeSniffer with exceptions:
- I was not able to modify UTF-8 file: "expected OR but found or" core/utf8/transliterate_to_ascii.php:1
- "Function name "__" is invalid; only PHP magic functions should be prefixed with a double underscore" core/classes/Kohana/I18n.php:155
- "Method name "exchangeArray" is not in all lowercase using underscores for word separators" core/classes/Kohana/HTTP/Header.php:417
- "Whitespace before a closing parenthesis is not allowed" core/classes/Kohana/Arr.php:443
- "Whitespace before a closing parenthesis is not allowed" core/classes/Kohana/Arr.php:475
2494b47
@kiall kiall Merge pull request #252 from yakatz/3.3/cleanup
Passes CodeSniffer with  exceptions:
df926cf
@randomecho randomecho links need updating to new locations, less 301 redirects 97548fc
@randomecho randomecho api links for kohana are presumed without parenthesis 7b65953
@shadowhand shadowhand Merge pull request #253 from randomecho/3.3/develop
Fix linkrot on intro page, remove other 301 redirects
fa03e79
@randomecho randomecho copyedit for sentence flow, typo and adding wikipedia link 728ab7a
@shadowhand shadowhand Merge pull request #254 from randomecho/3.3/develop
Copyedits on Sharing Kohana for flow, Wikipedia link and typo
70f8cf4
Diogo Tozzi Added some code examples in installation userguide. a39c017
@kiall kiall closed this
@EvanPurkhiser
Collaborator

It doesn't look like this commit made it into v3.2.1, so the send_file functionality is actually still broken in v3.2.1 due to 3bc535e.

I've opened a ticket in redmine for this issue.

@Zeelot
Owner

This seems wrong, we shouldn't be calling array_key_exists() on objects at all

Collaborator

Not sure if I agree. Objects providing the array interface should be first class arrays (although, php doesn't treat them like that).

Owner

I mean it's wrong based on php telling us not to do it even though it seems to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.