From http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-1253
I can't judge whether this is resolved or not.
Description:
Owncloud 4.0.4 to Owncloud 4.0.7, Linux, Mysql 5.0.95, php 5.3.10,
mimetype from mimetypes.list.php aren't writing in db->oc_fscache.
Reproduction steps:
Look into database -> oc_fscache if all mimetypes are set.
#1 Comment posted by Yoh Jul 13, 10:18
In lib/helper.php line 460, strncmp function is used. Return values of this function (php.net) is :
Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
If i replace :
if (!strncmp(PHP_OS, "WIN", 3)) {
by :
if (strncmp(PHP_OS, "WIN", 3)!=0) {
and then delete all db->oc_fscache entries
this solves my problem.
#3 Comment posted by Björn Jul 19, 09:17
I just looked at it but I don't really understand your solution. The if-statement should be true if PHP_OS is "WIN", but your modification does exactly the opposite.
#4 Comment posted by Yoh Jul 19, 13:53
Have you seen ! before strncmp ?
#5 Comment posted by Björn Aug 02, 14:14
@yoh:
yes, but the if-branch should be executed if PHP_OS equals "WIN". That means that the if-statement should be evaluated to 'true' if strncmp() returns '0'. So the right expression should be either "if (!strncmp(PHP_OS, "WIN", 3))" (because '0' is interpreted as 'false') or "if (strncmp(PHP_OS, "WIN", 3)==0)".
I don't know why it works on your system with "if (strncmp(PHP_OS, "WIN", 3)!=0)" but it doesn't look like a general solution. Maybe you can verify which branch gets executed on your system? Running on GNU/Linux ownCloud should execute the else branch.
#6 Comment posted by Yoh Aug 03, 06:26
Hi,
Running on Linux.
echo strncmp(PHP_OS, "WIN", 3); -> -1
Negate -1 -> ????? (It's not boolean)
And the other branch isn't execute for me.
#8 Comment posted by Björn Sep 18, 10:56
See the PHP documentation: http://www.php.net/manual/en/language.types.boolean.php
Every number different to '0'should be interpreted as true, including negative numbers. Even if this doesn't work on your system, than this changes:
if (strncmp(PHP_OS, "WIN", 3)!=0) {
still don't work. As you said you get '-1' for non Windows systems, so the if statement would be true and would lead you in the "Windows-branch" instead of the "Linux-branch". I could make the comparison explicit but than the statement needs to be:
if (strncmp(PHP_OS, "WIN", 3)==0) {
If this helps I can make this changes to to code.
#9 Comment posted by Frank Oct 02, 10:52
Can you check if the proposed fix from Björn is working?
From http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-1253
I can't judge whether this is resolved or not.
Description:
Owncloud 4.0.4 to Owncloud 4.0.7, Linux, Mysql 5.0.95, php 5.3.10,
mimetype from mimetypes.list.php aren't writing in db->oc_fscache.
Reproduction steps:
Look into database -> oc_fscache if all mimetypes are set.
#1 Comment posted by Yoh Jul 13, 10:18
In lib/helper.php line 460, strncmp function is used. Return values of this function (php.net) is :
Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
If i replace :
by :
and then delete all db->oc_fscache entries
this solves my problem.
#3 Comment posted by Björn Jul 19, 09:17
I just looked at it but I don't really understand your solution. The if-statement should be true if PHP_OS is "WIN", but your modification does exactly the opposite.
#4 Comment posted by Yoh Jul 19, 13:53
Have you seen ! before strncmp ?
#5 Comment posted by Björn Aug 02, 14:14
@yoh:
yes, but the if-branch should be executed if PHP_OS equals "WIN". That means that the if-statement should be evaluated to 'true' if strncmp() returns '0'. So the right expression should be either "if (!strncmp(PHP_OS, "WIN", 3))" (because '0' is interpreted as 'false') or "if (strncmp(PHP_OS, "WIN", 3)==0)".
I don't know why it works on your system with "if (strncmp(PHP_OS, "WIN", 3)!=0)" but it doesn't look like a general solution. Maybe you can verify which branch gets executed on your system? Running on GNU/Linux ownCloud should execute the else branch.
#6 Comment posted by Yoh Aug 03, 06:26
Hi,
Running on Linux.
echo strncmp(PHP_OS, "WIN", 3); -> -1
Negate -1 -> ????? (It's not boolean)
And the other branch isn't execute for me.
#8 Comment posted by Björn Sep 18, 10:56
See the PHP documentation: http://www.php.net/manual/en/language.types.boolean.php
Every number different to '0'should be interpreted as true, including negative numbers. Even if this doesn't work on your system, than this changes:
still don't work. As you said you get '-1' for non Windows systems, so the if statement would be true and would lead you in the "Windows-branch" instead of the "Linux-branch". I could make the comparison explicit but than the statement needs to be:
If this helps I can make this changes to to code.
#9 Comment posted by Frank Oct 02, 10:52
Can you check if the proposed fix from Björn is working?