Open 3l3ktr0n opened 1 year ago
Where is your e_url.php file? It is not in your repo. Or what is your config for 'editreview' key?
$config['editreview'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/reviews/([0-9]+)/([^/]+)/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/reviews/{review_id}/{review_sef}/{edit}',
'redirect' => '{e_PLUGIN}games/review.php?id=$1&review=$3&action=$5'
);
and this behaviour is present only in some reviews not all
No idea. Sorry. From my experience, some other rewrite is used before your own, but your regex is so specific that I don't know. Last time when this happened to me I debugged application.php line by line to find the reason.
And there is some debug to get displayed what rewrite was used but I don't remember it.
for some reason games/7/test-6/reviews/59/test/edit gives me
e_URL in games with key: newreview matched ^games/([0-9]+)/([^/]+)/reviews/([^/]+)/?$ and included: ./e107_plugins/games/review.php with $_GET:
Array
(
[id] => 7
[action] => 59edit
)
it's looking for the wrong key for no known reason.......................
but changing 'review_sef' => eHelper::title2sef($this->var['review_title'], 'dashl')
to whatever gets me
e_URL in games with key: editreview matched ^games/([0-9]+)/([^/]+)/reviews/([0-9]+)/([^/]+)/([^/]+)/?$ and included: ./e107_plugins/games/review.php with $_GET:
Array
(
[id] => 7
[review] => 59
[action] => edit
)
$config['newreview'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/reviews/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/reviews/{new}',
'redirect' => '{e_PLUGIN}games/review.php?id=$1&action=$3'
);
In this case - only your real URL and 'regex' value from your config file is important.
Use https://regex101.com/ why for your URL is wrong regex used (you need to add backslashes there)
Maybe reorder them.
games/7/test-6/reviews/59/test/edit
and regex from 'newreview' - is valid
Do you use it before editreview?
I don know how your URL looks after "but changing ... to whatever gets me" not to pass this regex and use next one.
but 'newreview' isnt using backslashes also
but 'newreview' isnt using backslashes also
Sorry, misunderstanding - I meant that if you want to use that regex tool, you need to add backslashes, e_url doesn't need them.
In this case - only your real URL and 'regex' value from your config file is important. Use https://regex101.com/ why for your URL is wrong regex used (you need to add backslashes there) Maybe reorder them. games/7/test-6/reviews/59/test/edit and regex from 'newreview' - is valid
Do you use it before editreview? I don know how your URL looks after "but changing ... to whatever gets me" not to pass this regex and use next one.
I have been using it from time to time and haven't noticed any erros - although I don't really understand how the regex101.com debugger works
I'm at my wits. I still haven't figured out how to fix it or what exactly causes it. I have singled out that for some reason the right url games/7/test-6/reviews/59/test/edit - 'test' seems to be responsible for the $_GET that identifies the review_id not to get the id for an unknown reason
games/7/test-6/reviews/59/test/edit
e_URL in games with key: newreview matched ^games/([0-9]+)/([^/]+)/reviews/([^/]+)/?$ and included: ./e107_plugins/games/review.php with $_GET:
Array
(
[id] => 7
[action] => 59edit
)
games/7/test-6/reviews/59/whatever/edit
e_URL in games with key: editreview matched ^games/([0-9]+)/([^/]+)/reviews/([0-9]+)/([^/]+)/([^/]+)/?$ and included: ./e107_plugins/games/review.php with $_GET:
Array
(
[id] => 7
[review] => 59
[action] => edit
)
no idea how to reproduce it for others but I'm still facing this problem
was thinking maybe eHelper::title2sef is causing this.. changed straight to the row from database for sef.. nothing changed.. same same tried changing the value in the database.. still not working
I cant figure out if the mistake is in e107 or me but it's kinda game breaking currently
This is likely a mistake in your e_url.php file, not in core.
Can you please post:
e_url.php
file<?php
/*
* e107 Bootstrap CMS
*
* Copyright (C) 2008-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* }
*
*/
if(!defined('e107_INIT'))
{
exit;
}
// v2.x Standard - Simple mod-rewrite module.
class games_url // plugin-folder + '_url'
{
function config()
{
$config = array();
$config['games'] = array(
'alias' => 'games',
'regex' => '^{alias}\/?([\?].*)?\/?$',
'sef' => '{alias}',
'redirect' => '{e_PLUGIN}games/games.php$1'
);
$config['game'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}',
'redirect' => '{e_BASE}game.php?id=$1'
);
$config['navigation'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/{page}',
'redirect' => '{e_BASE}game.php?id=$1&page=$3'
);
$config['review'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/reviews/([0-9]+)/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/reviews/{review_id}/{review_sef}',
'redirect' => '{e_PLUGIN}games/review.php?id=$1&review=$3'
);
$config['newreview'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/reviews/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/reviews/{new}',
'redirect' => '{e_PLUGIN}games/review.php?id=$1&action=$3'
);
$config['editreview'] = array(
'alias' => 'games',
'regex' => '^{alias}/([0-9]+)/([^/]+)/reviews/([0-9]+)/([^/]+)/([^/]+)/?$',
'sef' => '{alias}/{game_id}/{game_sef}/reviews/{review_id}/{review_sef}/{edit}',
'redirect' => '{e_PLUGIN}games/review.php?id=$1&review=$3&action=$5'
);
return $config;
}
}
?>
games/2/test-2/reviews/29/1234567890/edit - correct
games/7/test-6/reviews/59/test/edit - correct but fails games/7/test-6/reviews/59/whatever/edit - for some reason changing {review_sef} makes it work...
have been trying to get help from AI. not really helpful well.. for some reason
$data = array(
'game_id' => $gameID,
'game_sef' => $this->var['game_sef'],
'review_id' => $this->var['review_id'],
'review_sef' => $this->var['review_sef'],
'edit' => $action = 'edit'
);
$url = e107::url('games', 'editreview', $data);
when fetching review_sef from the database it still fails when the value is 'test' but when i change it for example 'test1' then it works and currently having this problem with a single review
I'm encountering some weird SEF behaviour. Having SEF enabled some urls don't work anymore. For example (SEF not enabled) - review.php?id=7&review=59
everything is working fine now SEF enabled - reviews/59/test/edit
but when I change the url to - reviews/59/tes/edit - then it works
Sorry for my bad explanation...