adelahmd / mollify

Automatically exported from code.google.com/p/mollify
0 stars 0 forks source link

Path delimiter slash & regexp #597

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Mollify version 2.6.2

After successfull install, login try ends with error. DEBUG LOG:

MySQLi DB: usr_mollify@localhost:db_mollify()DB QUERY: select id, user_id, ip, 
time, last_access from session where id = '154d6558a1e8a2' and last_access >= 
20150207173323DB QUERY: select name, value from session_data where session_id = 
'154d6558a1e8a2'DB QUERY: SELECT id, name, user_type, lang, email, expiration, 
ua.type as auth FROM user left outer join user_auth ua on id=ua.user_id WHERE 
id='1' AND (expiration is null or expiration > 20150207193323)DB QUERY: select 
id, name, description from user where id in (SELECT user_group.group_id FROM 
user as user, user_group as user_group where user_group.user_id = user.id and 
user.id = '1') ORDER BY id ASCDB QUERY: UPDATE session set 
last_access=20150207193323 where id='154d6558a1e8a2'Filesystem registered: 
localEVENT HANDLER: registering 'filesystem/': FilesystemControllerVERSION: 
2.6.2 SERVER: {CONTENT_TYPE:application/json, 
HTTP_X_REQUESTED_WITH:XMLHttpRequest, 
HTTP_REFERER:http://hamburg.itz-vos.de/WebExplorer/, 
HTTP_COOKIE:mollify_app_session=154d6558a1e8a2, REQUEST_SCHEME:http, 
CONTEXT_PREFIX:/WebExplorer, CONTEXT_DOCUMENT_ROOT:/srv/www/htdocs/mollify, 
SCRIPT_FILENAME:/srv/www/htdocs/mollify/backend/r.php, 
SERVER_PROTOCOL:HTTP/1.1, REQUEST_METHOD:GET, QUERY_STRING:, 
REQUEST_URI:/WebExplorer/backend/r.php/session/info/, 
SCRIPT_NAME:/WebExplorer/backend/r.php, PATH_INFO:/session/info/, 
PATH_TRANSLATED:/srv/www/vhosts/my-url/session/info/, 
PHP_SELF:/WebExplorer/backend/r.php/session/info/, 
REQUEST_TIME_FLOAT:1423334003.831, REQUEST_TIME:1423334003}SETTINGS: 
{db:{type:mysql, database:db_mollify, user:usr_mollify, password:, 
charset:utf8}, plugins:{FileViewerEditor:{viewers:{Image:{0:gif, 1:png, 
2:jpg}}, previewers:{Image:{0:gif, 1:png, 2:jpg}}}, ItemDetails:{}}, 
timezone:Europe/Berlin, debug:1, 
debug_log:/var/log/apache2/mollify_debug.log}FEATURES: {limited_http_methods:1, 
change_password:1, descriptions:1, user_groups:1, mail_notification:1, 
retrieve_url:1, folder_protection:1, thumbnails:1, guest_mode:1, file_view:1, 
file_preview:1, file_edit:1}FILESYSTEM: allowed_file_upload_types={}SESSION: 
is_active=1, user={id:1, name:ITZAdmin, user_type:a, lang:, email:, 
expiration:, auth:}, data={auth:}AUTH: is_authenticated=1REQUEST: method=get, 
path={0:session, 1:info}, ip=xxx.xxx.xxx.xxx, params={}, data=SERVICE 
(SessionServices)DB QUERY: select id, path from item_id where path REGEXP 
'^.:[/\\]$'ServiceException: INVALID_CONFIGURATION=Error executing query 
(select id, path from item_id where path REGEXP '^.:[/\\]$'): Got error 
'missing terminating ] for character class at offset 8' from 
regexp{0:{file:/srv/www/htdocs/mollify/backend/include/filesystem/ItemIdProvider
.class.php, line:50, function:query, class:MySQLIDatabase, type:->, 
args:{0:select id, path from item_id where path REGEXP '^.:[/\\]$'}}, 
1:{file:/srv/www/htdocs/mollify/backend/include/filesystem/FilesystemController.
class.php, line:378, function:loadRoots, class:ItemIdProvider, type:->, 
args:{}}, 
2:{file:/srv/www/htdocs/mollify/backend/include/services/SessionServices.class.p
hp, line:93, function:getSessionInfo, class:FilesystemController, type:->, 
args:{}}, 
3:{file:/srv/www/htdocs/mollify/backend/include/services/SessionServices.class.p
hp, line:48, function:getSessionInfo, class:SessionServices, type:->, args:{}}, 
4:{file:/srv/www/htdocs/mollify/backend/include/services/ServicesBase.class.php,
 line:53, function:processGet, class:SessionServices, type:->, args:{}}, 
5:{file:/srv/www/htdocs/mollify/backend/include/MollifyBackend.class.php, 
line:85, function:processRequest, class:ServicesBase, type:->, args:{}}, 
6:{file:/srv/www/htdocs/mollify/backend/r.php, line:81, 
function:processRequest, class:MollifyBackend, type:->, 
args:{0:Request}}}RESPONSE error {0:105, 1:Invalid configuration, 2:403} Error 
executing query (select id, path from item_id where path REGEXP '^.:[/\\]$'): 
Got error 'missing terminating ] for character class at offset 8' from regexp 

Thanks !

Original issue reported on code.google.com by soost.on...@googlemail.com on 7 Feb 2015 at 6:52

GoogleCodeExporter commented 8 years ago
The error suggests regexp failure, which sounds weird. Those have been there 
for such a long time without nobody reporting errors, and I haven't seen any 
problems with any mysql versions I've tried.

The regex here is '^.:[/\\]$', and by the error (missing terminating "]") it 
seems like your mysql escapes the closing bracket. It shouldn't, the escape is 
for the "\".

You are not using Windows, are you?

Original comment by mollify....@gmail.com on 10 Feb 2015 at 4:43

GoogleCodeExporter commented 8 years ago
Yes Sir, I agree, it seems to be an error of MySQL.

System is a Linux, Kernel 3.16.7-7, MySQL Server 10.0.13-MariaDB openSUSE 
package

Mollify DB is an InnoDB, utf8_general_ci

Maybe there's some trouble with Kollation ? Any suggestions for further 
debugging options ?

Note: with other installations of mollify no touble, same environment like this.

Original comment by soost.on...@googlemail.com on 11 Feb 2015 at 8:48

GoogleCodeExporter commented 8 years ago
You could try running the query directly on MySQL, for example via phpMyAdmin.

The query is this:

select id, path from item_id where path REGEXP '^.:[/\\]$'

Try to see what error is there, and can you make it work with some 
modifications. For me it's hard to fix this since I don't have this error in my 
system, would have to know what is wrong with that query (for me it looks 
perfectly valid).

You could try something like

select id, path from item_id where path REGEXP '^.:[\/\\]$'

or

select id, path from item_id where path REGEXP '^.:[/]$'

Original comment by mollify....@gmail.com on 11 Feb 2015 at 9:50

GoogleCodeExporter commented 8 years ago
I tried a directly query on MySQL, and that's the result:

select id, path from item_id where path REGEXP '^.:[/]$'

This query works without an error !

So far, so good :-) How to fix it ? Shoud I do it my self in my installation ? 
Tell me the place, I'll change it !

Original comment by soost.on...@googlemail.com on 12 Feb 2015 at 12:59

GoogleCodeExporter commented 8 years ago
So the other gave you errors? Weird, they should be all valid.

What about this one:
select id, path from item_id where path REGEXP '^.:[[.apostrophe.][.slash.]]$'

The problem is Windows, which is why I have both of the options "/" and "\" 
there. I guess I could normalize Windows paths to use "/" also, that would be 
the proper solution.

But the only way to change into your installation is to find/replace 
recursively in all files following strings:

1) find "[/\\\\]" and replace with "[[.apostrophe.][.slash.]]" (or "[/]")
2) find "[^/\\\\]" and replace with "[^[.apostrophe.][.slash.]]" (or "[^/]")

But be careful, wrong regexp will break everything.

I'll make this accepted, as I'll try to see I could make the path normalization 
and then I could remove the slash entirely from regexp.

Original comment by mollify....@gmail.com on 12 Feb 2015 at 1:55

GoogleCodeExporter commented 8 years ago
Yep, all other syntax of query brings error, except this one:

select id, path from item_id where path REGEXP '^.:[/]$'

Ok, I'll follow your suggestion with these steps:

1) backup the install-directory and MySQL database (it's a fresh install...)
2) find/replace recursively the query string
3) test installation again
4) reporting result

Here we go !

Original comment by soost.on...@googlemail.com on 12 Feb 2015 at 2:58

GoogleCodeExporter commented 8 years ago
I tried this one too (direct query):

select id, path from item_id where path REGEXP '^.:[[.apostrophe.][.slash.]]$'

MySQL Result:

#1139 - Got error 'POSIX collating elements are not supported at offset 4' from 
regexp 

Original comment by soost.on...@googlemail.com on 12 Feb 2015 at 3:08

GoogleCodeExporter commented 8 years ago
tried to search/replace the string, but this don't work properly...

Think this method isnt really a good workaround.

So I decide to stop using mollify this time and waiting for a developer 
solution.

Original comment by soost.on...@googlemail.com on 16 Feb 2015 at 9:11

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I had the same error. I fixed it by replacing
[/\\\\] to [/1-\\x5C]
and
[^/\\\\] to [^/1-\\x5C]

Original comment by starose...@gmail.com on 19 Feb 2015 at 7:13

GoogleCodeExporter commented 8 years ago
As Google Code is announced to be shut down, I'm moving accepted issues into 
GitHub: https://github.com/sjarvela/mollify/issues/12

Original comment by samuli.j...@gmail.com on 13 Mar 2015 at 9:31