[synchronization] Unable to synchronize directories starting with special names #201

Open
opened 2026-10-04 23:47:03 +02:00 by adam · 2 comments
Owner

Reported by gospogied on 2 Oct 2012 07:29

Version: 2.4.4

basename() is locale dependent so before it we must setlocale for special strings.

Steps to reproduce: 1. Edit
change in file include/config_default.inc.php line 743
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-.]+$/';
to
$conf['sync_chars_regex'] = '/^[a-zA-Z??ó????????Ó??????0-9-
. (),%+-~#@!*]+$/';
2. Create dir:
mkdir /PATH/TO/PIWIGO/galleries/?uk /PATH/TO/PIWIGO/galleries/luk /PATH/TO/PIWIGO/galleries/ku?
3. Synchronize.
Now You can see following albums in piwigo: uk luk ku?
So it ignores special characters in first positions.

The problem is in admin/site_update.php line 210.
To solve it you must add one line before it, for my language it is:

setlocale(LC_ALL, 'pl_PL.UTF-8');
$dir = basename($fulldir);

Additional information: Fixed by hand, but should be automated and probably basenames in other places also should be setlocaled first.

Piwigo Bugtracker #2758

**Reported by gospogied on 2 Oct 2012 07:29** **Version:** 2.4.4 basename() is locale dependent so before it we must setlocale for special strings. **Steps to reproduce:** 1. Edit change in file include/config_default.inc.php line 743 $conf[&#039;sync_chars_regex&#039;] = &#039;/^[a-zA-Z0-9-_.]+$/&#039;; to $conf[&#039;sync_chars_regex&#039;] = &#039;/^[a-zA-Z??ó????????Ó??????0-9-_. (),%+-~#@!*]+$/&#039;; 2. Create dir: mkdir /PATH/TO/PIWIGO/galleries/?uk /PATH/TO/PIWIGO/galleries/luk /PATH/TO/PIWIGO/galleries/ku? 3. Synchronize. Now You can see following albums in piwigo: uk luk ku? So it ignores special characters in first positions. The problem is in admin/site_update.php line 210. To solve it you must add one line before it, for my language it is: setlocale(LC_ALL, &#039;pl_PL.UTF-8&#039;); $dir = basename($fulldir); **Additional information:** Fixed by hand, but should be automated and probably basenames in other places also should be setlocaled first. [Piwigo Bugtracker #2758](http://piwigo.org/bugs/view.php?id=2758) <!-- github-sync-id:97226453 -->
Author
Owner

Comment posted by gospogied on 2 Oct 2012 08:15

It seems that bugtracker doesn't like locales, according to ????

**Comment posted by gospogied on 2 Oct 2012 08:15** It seems that bugtracker doesn&#039;t like locales, according to ???? <!-- github-comment-id:124892841 -->
Author
Owner

Comment posted by m_alien on 31 Oct 2014 07:41

in piwigo 2.7.1 same broblem, and the same solution:

The problem is in admin/site_update.php line 210.
To solve it you must add one line before it, for my language it is:

setlocale(LC_ALL, 'ru_RU.UTF-8');
$dir = basename($fulldir);

and in i.php I add

setlocale(LC_ALL, 'ru_RU.UTF-8');

**Comment posted by m_alien on 31 Oct 2014 07:41** in piwigo 2.7.1 same broblem, and the same solution: The problem is in admin/site_update.php line 210. To solve it you must add one line before it, for my language it is: setlocale(LC_ALL, &#039;ru_RU.UTF-8&#039;); $dir = basename($fulldir); and in i.php I add setlocale(LC_ALL, &#039;ru_RU.UTF-8&#039;); <!-- github-comment-id:124892854 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#201