luyadev / luya

LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.
https://luya.io
MIT License
811 stars 205 forks source link

"adminka" contains reserved word "admin" #2019

Closed ghost closed 4 years ago

ghost commented 4 years ago

What steps will reproduce the problem?

i am install fresh luya on local computer using xamp by https://luya.io/guide/install in admin\setup i choose English version and locale en. i am login in /admin and create page with Page Title Adminka and URL Path segment adminka and Layout selection Main. I am change for this page state to Online and when i clicked to open url in new window and get error page Not Found (#404)

What is the expected result?

page Adminka

What do you get instead? (A Screenshot can help us a lot!)

page Not Found (#404)

LUYA Check output (run this script and post the result: luyacheck.php)

i am run php luyacheck.php in luya base folder output for this script is null

Additional infos

| LUYA Version

composer info

bower-asset/bootstrap v3.4.1 The most popular front-end fram... bower-asset/inputmask 3.3.11 Inputmask is a javascript libra... bower-asset/jquery 3.4.1 bower-asset/punycode v1.3.2 bower-asset/typeahead.js v0.11.1 bower-asset/yii2-pjax 2.0.7.1 cebe/markdown 1.2.1 A super fast, highly extensible... curl/curl 1.1.5 cURL class for PHP doctrine/instantiator 1.3.0 A small, lightweight utility to... ezyang/htmlpurifier v4.12.0 Standards compliant HTML filter... flowjs/flow-php-server v1.0.3 PHP library for handling chunk ... giggsey/libphonenumber-for-php 8.12.2 PHP Port of Google's libphonenu... giggsey/locale 1.8 Locale functions required by li... imagine/imagine v0.7.1 Image processing for PHP 5.3 luyadev/luya-bootstrap3 1.0.8 LUYA Bootstrap 3 content luyadev/luya-composer 1.1.1 LUYA composer core luyadev/luya-core 1.0.26 LUYA is a scalable web framewor... luyadev/luya-generic 1.0.5 LUYA Generic content luyadev/luya-module-admin 1.0.3.1 Administration core module for ... luyadev/luya-module-cms 1.0.9.1 The LUYA CMS module provides a ... luyadev/luya-testsuite 1.0.31 TestCases and Data for LUYA Mod... myclabs/deep-copy 1.9.5 Create deep copies (clones) of ... phar-io/manifest 1.0.1 Component for reading phar.io m... phar-io/version 1.0.1 Library for handling version in... phpdocumentor/reflection-common 2.1.0 Common reflection classes used ... phpdocumentor/reflection-docblock 5.1.0 With this component, a library ... phpdocumentor/type-resolver 1.1.0 A PSR-5 based resolver of Class... phpmailer/phpmailer v6.1.5 PHPMailer is a full-featured em... phpspec/php-diff v1.1.0 A comprehensive library for gen... phpspec/prophecy v1.10.3 Highly opinionated mocking fram... phpunit/php-code-coverage 5.3.2 Library that provides collectio... phpunit/php-file-iterator 1.4.5 FilterIterator implementation t... phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 1.0.9 Utility class for timing phpunit/php-token-stream 2.0.2 Wrapper around PHP's tokenizer ... phpunit/phpunit 6.5.14 The PHP Unit Testing framework. phpunit/phpunit-mock-objects 5.0.10 Mock Object library for PHPUnit sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or meth... sebastian/comparator 2.1.3 Provides the functionality to c... sebastian/diff 2.0.1 Diff implementation sebastian/environment 3.1.0 Provides functionality to handl... sebastian/exporter 3.1.2 Provides the functionality to e... sebastian/global-state 2.0.0 Snapshotting of global state sebastian/object-enumerator 3.0.3 Traverses array structures and ... sebastian/object-reflector 1.1.1 Allows reflection of object att... sebastian/recursion-context 3.0.0 Provides functionality to recur... sebastian/resource-operations 1.0.0 Provides a list of PHP built-in... sebastian/version 2.0.1 Library that helps with managin... symfony/polyfill-ctype v1.15.0 Symfony polyfill for ctype func... theseer/tokenizer 1.1.3 A small library for converting ... twig/twig v1.42.5 Twig, the flexible, fast, and s... webmozart/assert 1.8.0 Assertions to validate method i... yiisoft/yii2 2.0.35 Yii PHP Framework Version 2 yiisoft/yii2-bootstrap 2.0.10 The Twitter Bootstrap extension... yiisoft/yii2-composer 2.0.9 The composer plugin for Yii ext... yiisoft/yii2-debug 2.0.14 The debugger extension for the ... yiisoft/yii2-gii 2.0.8 The Gii extension for the Yii f... yiisoft/yii2-imagine 2.1.1 The Imagine integration for the... | | PHP Version

php -v

PHP 7.3.9 (cli) (built: Aug 28 2019 09:28:48) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans | | Platform OpenServer | Operating system | Windows 10

nadar commented 4 years ago

Hi @kvonosan

So you can login into the LUYA admin and you also created a page there? And the "path" of the page you created is adminika. If you rename that path to foobar itworks? could you test that? Did i understand correctly?

ghost commented 4 years ago

If i rename path adminka to foobar it works correctly.

ghost commented 4 years ago

And the "path" of the page you created is adminika. Not adminika. It is adminka

nadar commented 4 years ago

I think i see the problem it contains a reserved word admin. I take a closer look at this. Thanks for the report.

ghost commented 4 years ago

I am debuged this bug. In file vendor/luyadev/luya-core/web/Request.php In 73 line code if (preg_match('/admin/i', $first, $results)) { $this->_isAdmin = true; } else { $this->_isAdmin = false; }

set it code to if (preg_match('/\badmin\b/i', $first, $results)) { $this->_isAdmin = true; } else { $this->_isAdmin = false; }

nadar commented 4 years ago

Yes, this was exactly my assume. I will make a PR with some unit tests later. And as it seems to be luya core i'll move it again :-)