-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEEDS REVIEW] Fix #1040 #1153
Closed
Closed
[NEEDS REVIEW] Fix #1040 #1153
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bd10fbb
Fix #1040
sjinks 0b96b3b
Updated tests
sjinks f93d584
Optimizations
sjinks db9d382
Interned strings
sjinks aaea07e
Make tests pass
sjinks 5f85205
Test case for #1275
sjinks 429d6d3
Fix #1275
sjinks 6d74a38
Fix controller length for #1275
sjinks 5d125cb
Fixing #1829
sjinks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make tests pass
- Loading branch information
commit aaea07eb5efa3368572276fe53b5d4ef0b8b59cc
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -817,39 +817,40 @@ PHP_METHOD(Phalcon_Mvc_Router, handle){ | |
PHALCON_GET_HKEY(part, ah1, hp1); | ||
PHALCON_GET_HVALUE(position); | ||
|
||
if (phalcon_array_isset_fetch(&match_position, matches, position)) { | ||
|
||
/** | ||
* Check if the part has a converter | ||
*/ | ||
if (phalcon_array_isset_fetch(&converter, converters, part)) { | ||
PHALCON_INIT_NVAR(parameters); | ||
array_init_size(parameters, 1); | ||
phalcon_array_append(¶meters, match_position, 0); | ||
|
||
PHALCON_INIT_NVAR(converted_part); | ||
PHALCON_CALL_USER_FUNC_ARRAY(converted_part, converter, parameters); | ||
phalcon_array_update_zval(&parts, part, &converted_part, PH_COPY); | ||
zend_hash_move_forward_ex(ah1, &hp1); | ||
continue; | ||
} | ||
|
||
/** | ||
* Update the parts if there is no converter | ||
*/ | ||
phalcon_array_update_zval(&parts, part, &match_position, PH_COPY); | ||
} else { | ||
/** | ||
* Apply the converters anyway | ||
*/ | ||
if (phalcon_array_isset_fetch(&converter, converters, part)) { | ||
PHALCON_INIT_NVAR(parameters); | ||
array_init_size(parameters, 1); | ||
phalcon_array_append(¶meters, position, 0); | ||
|
||
PHALCON_INIT_NVAR(converted_part); | ||
PHALCON_CALL_USER_FUNC_ARRAY(converted_part, converter, parameters); | ||
phalcon_array_update_zval(&parts, part, &converted_part, PH_COPY); | ||
if (Z_TYPE_P(part) != IS_STRING || Z_STRVAL_P(part)[0] != '\0') { | ||
if (phalcon_array_isset_fetch(&match_position, matches, position)) { | ||
/** | ||
* Check if the part has a converter | ||
*/ | ||
if (phalcon_array_isset_fetch(&converter, converters, part)) { | ||
PHALCON_INIT_NVAR(parameters); | ||
array_init_size(parameters, 1); | ||
phalcon_array_append(¶meters, match_position, 0); | ||
|
||
PHALCON_INIT_NVAR(converted_part); | ||
PHALCON_CALL_USER_FUNC_ARRAY(converted_part, converter, parameters); | ||
phalcon_array_update_zval(&parts, part, &converted_part, PH_COPY); | ||
zend_hash_move_forward_ex(ah1, &hp1); | ||
continue; | ||
} | ||
|
||
/** | ||
* Update the parts if there is no converter | ||
*/ | ||
phalcon_array_update_zval(&parts, part, &match_position, PH_COPY); | ||
} else { | ||
/** | ||
* Apply the converters anyway | ||
*/ | ||
if (phalcon_array_isset_fetch(&converter, converters, part)) { | ||
PHALCON_INIT_NVAR(parameters); | ||
array_init_size(parameters, 1); | ||
phalcon_array_append(¶meters, position, 0); | ||
|
||
PHALCON_INIT_NVAR(converted_part); | ||
PHALCON_CALL_USER_FUNC_ARRAY(converted_part, converter, parameters); | ||
phalcon_array_update_zval(&parts, part, &converted_part, PH_COPY); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -912,9 +913,14 @@ PHP_METHOD(Phalcon_Mvc_Router, handle){ | |
phalcon_update_property_this(this_ptr, SL("_module"), tmp TSRMLS_CC); | ||
} | ||
|
||
if (phalcon_array_isset_string_fetch(&exact, parts, SS("exact"))) { | ||
if (phalcon_array_isset_string_fetch(&exact, parts, SS("\0exact"))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
phalcon_update_property_this(this_ptr, SL("_isExactControllerName"), exact TSRMLS_CC); | ||
phalcon_array_unset_string(&parts, SS("\0exact"), PH_SEPARATE); | ||
} | ||
else { | ||
PHALCON_INIT_VAR(exact); | ||
ZVAL_FALSE(exact); | ||
phalcon_update_property_this(this_ptr, SL("_isExactControllerName"), exact TSRMLS_CC); | ||
phalcon_array_unset_string(&parts, SS("exact"), PH_SEPARATE); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,7 +465,7 @@ PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation){ | |
zval *empty_str, *real_action_name, *action_name; | ||
zval *parameter = NULL, *paths = NULL, *position; | ||
zval *value, *uri = NULL, *route, *converts = NULL, *convert = NULL, *param = NULL; | ||
zval *conversor_param = NULL, *route_name; | ||
zval *conversor_param = NULL, *route_name, *z_true; | ||
HashTable *ah0, *ah1; | ||
HashPosition hp0, hp1; | ||
zval **hd; | ||
|
@@ -543,10 +543,13 @@ PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation){ | |
if (Z_TYPE_P(namespace) == IS_STRING) { | ||
phalcon_array_update_string(&paths, ISL(namespace), &namespace, PH_COPY | PH_SEPARATE); | ||
} | ||
|
||
PHALCON_INIT_VAR(z_true); | ||
ZVAL_TRUE(z_true); | ||
|
||
phalcon_array_update_string(&paths, ISL(controller), &controller, PH_COPY | PH_SEPARATE); | ||
phalcon_array_update_string(&paths, ISL(action), &action_name, PH_COPY | PH_SEPARATE); | ||
add_assoc_bool_ex(paths, SS("exact"), 1); | ||
phalcon_array_update_string(&paths, ISL(action), &action_name, PH_COPY); | ||
phalcon_array_update_string(&paths, SL("\0exact"), &z_true, PH_COPY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal property |
||
|
||
PHALCON_INIT_VAR(position); | ||
ZVAL_LONG(position, 0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally used keys are strings and start with a binary 0 (so that they do not clash with user defined parameters)