Fork me on GitHub

#1 2012-02-14 12:53:59

redfan9
Member
Registered: 2011-12-07
Posts: 14

[FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Hi all, it's me again. smile

Recently i found some bug(s) while i'm using oneye. First, i got stuck when i want to logout from oneye, this is happen after i disable the sound notification, when i turn it on again, and i can logout succesfully. Second, i'm testing the upload feature but then i found this error that i couldn't upload file bigger than >8MB, i tried upload file <8 MB's size and it success, but it give me error when i upload it bigger than 8MB. I don't know why, but at the upload dialog box(?) it shows that max filesize allowed is 128MB. anybody could help me fix this?

I'm really enjoy using oneye and now i'm trying to implement this oneye at my school so that the students could use this as their cloud storage. So, can anybody inform me how to get a fast response help support? via MSN/YM will do.. thank you smile

Last edited by redfan9 (2012-02-14 12:54:50)

Offline

#2 2012-02-14 17:18:28

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Hi redfan9, welcome back.

The bug where the logout sticks can be fixed locally by changing line 35 of [eyeroot]/apps/exit/app.eyecode from

$timeout = '0';

to

$timeout = '1';

I will commit this to svn soon.

As to the file upload limit: what are the values of upload_max_filesize and post_max_size on your php installation?

And for slightly quicker communication, we do have an IRC channel on freenode: #oneye. Although there isn't always anyone on it, it may prove to be a useful place to look for help. If you don't have an irc client, you can go to http://webchat.freenode.net and connect via that (Enter '#oneye' into 'channels' and, for clarity, use your username here as your nickname there).

Offline

#3 2012-02-14 19:13:52

redfan9
Member
Registered: 2011-12-07
Posts: 14

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

s0600204 wrote:

Hi redfan9, welcome back.

The bug where the logout sticks can be fixed locally by changing line 35 of [eyeroot]/apps/exit/app.eyecode from

$timeout = '0';

to

$timeout = '1';

I will commit this to svn soon.

As to the file upload limit: what are the values of upload_max_filesize and post_max_size on your php installation?

And for slightly quicker communication, we do have an IRC channel on freenode: #oneye. Although there isn't always anyone on it, it may prove to be a useful place to look for help. If you don't have an irc client, you can go to http://webchat.freenode.net and connect via that (Enter '#oneye' into 'channels' and, for clarity, use your username here as your nickname there).

hi s0600204, thanks for your assist!!! it help me fix the sound problem.

As to the file upload limit: what are the values of upload_max_filesize and post_max_size on your php installation?

where exactly i should check those values? at my php.ini file?

Offline

#4 2012-02-14 19:47:23

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

where exactly i should check those values? at my php.ini file?

Or using the phpinfo() function, yes.

Offline

#5 2012-02-14 19:55:58

redfan9
Member
Registered: 2011-12-07
Posts: 14

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

s0600204 wrote:

where exactly i should check those values? at my php.ini file?

Or using the phpinfo() function, yes.

alright, the upload_max_size value is 128M and the post_max_size value is 8M, so that should be the problem, right? smile
i'll try to change and test it first if this would solve the problem. smile

Offline

#6 2012-02-14 20:06:45

redfan9
Member
Registered: 2011-12-07
Posts: 14

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

i've tried to change the post_max_value to 50M but still got error when i want to upload a file bigger that 8 MB... sad

Offline

#7 2012-02-14 20:14:28

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Did you remember to restart the webserver?

Also, is php configured with --enable-memory-limit?

Also, do you know the exact error message given by php (not oneye)?

Last edited by s0600204 (2012-02-14 20:33:49)

Offline

#8 2012-02-14 21:22:33

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 730
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

we should change the algorithm to get the minimum upload size to the following:

min(StringToBytes(ini_get('memory_limit')), StringToBytes(ini_get('post_max_size')), StringToBytes(ini_get('upload_max_filesize')))

where "StringToBytes" should be defined as follows (It should be a library function, though. What about creating a "misc" library):

function StringToBytes($value) {
	$factor = 1;
	$unit = substr($value, -1);
	if ($unit === 'k' || $unit === 'K') {
		$factor = 1024;
		$value = substr($value, 0, -1);
	} else if ($unit === 'm' || $unit === 'M') {
		$factor = 1024 * 1024;
		$value = substr($value, 0, -1);
	} else if ($unit === 'g' || $unit === 'G') {
		$factor = 1024 * 1024 * 1024;
		$value = substr($value, 0, -1);
	}
	return $factor * intval($value);
}

Best regards,
Lars Knickrehm

The oneye project.

Offline

#9 2012-02-14 23:28:04

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Lars,

I agree with the idea of changing the algorithm. I don't think we need to create a new library - it's a string-based function so we could put it in the eyeString library. Also, what do you think of this alternate stringToBytes function?:

function stringToBytes($value,$ini = false) {
	if ((!isset($value)) || (($value === -1) && (!$ini))) {
		errorCodes('setErrorCode',array(INCORRECT_PARAMS));
		return false;;
	}
	if ($value === -1) {	// in php.ini, '-1' = unlimited
		$unit = "T";
		$quantity = 1024;
	} else {
		$unit = utf8_strtoupper(utf8_substr(utf8_trim($value),-1));
		$quantity = intval(utf8_substr($value,0,-1));
	}
	switch ($unit) {
		case "T":
			$quantity *= 1024;
		case "G":
			$quantity *= 1024;
		case "M":
			$quantity *= 1024;
		case "K":
			$quantity *= 1024;
	}
	return $quantity;
}

Offline

#10 2012-02-14 23:39:11

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 730
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Looks good, but there are some points I'd like to mention:

  1. What's the $ini parameter about?

  2. "-1" should simply return the maximum integer value specified as PHP_INT_MAX .

  3. Beside you don't to use a new variable $quantity, as $value describes it better doesn't it?

  4. What about "123" as $value input? That's a problem!


Best regards,
Lars Knickrehm

The oneye project.

Offline

#11 2012-02-15 00:06:32

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Okay, how about this?:

function stringToBytes($value) {
	if (!isset($value)) {
		errorCodes('setErrorCode',array(INCORRECT_PARAMS));
		return false;
	}
	if ($value === -1) {	// in php.ini, '-1' = unlimited
		return PHP_INT_MAX;
	} else {
		$unit = utf8_strtoupper(utf8_substr(utf8_trim($value),-1));
		if ($unit === "B") {	// for dual character suffixes (.ie MB rather than M)
			$unit = utf8_strtoupper(utf8_substr(utf8_trim($value),-2,-1));
		}
	}
	switch ($unit) {
		case "T":
			$value *= 1024;
		case "G":
			$value *= 1024;
		case "M":
			$value *= 1024;
		case "K":
			$value *= 1024;
	}
	return $value;
}

Last edited by s0600204 (2012-02-15 00:44:35)

Offline

#12 2012-02-15 00:15:41

redfan9
Member
Registered: 2011-12-07
Posts: 14

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Hey guys, it works fine now... smile

It's so stupid that i forgot to restart the webserver after i change the php.ini configuration.
I was so sleepy at that time when i tested the config and forgot to restart the apache service. When i check again at the phpinfo() i still got 8M at the post_max_size value and i realize that i forgot to restart the service. And after i restart i works fine now.

Thank you s0600204 and also thanks Lars...!!! smile

Offline

#13 2012-02-15 01:15:00

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 730
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Based on your last idea, here's a new one. It returns the float value "INF" in case the value is negative...

function stringToBytes($value) {
	if (isset($value) === false) {
		errorCodes('setErrorCode', array(INCORRECT_PARAMS));
		return false;
	}
	
	// get integer value and a valid string
	$return = intval($value);
	$value = strval($value);
	
	// -1 means unlimited
	if ($return < 0) {
		return INF;
	}
	
	// get unit character
	$unit = utf8_strtolower(utf8_substr(utf8_trim($value), -1));
	if ($unit === 'b') {
		$unit = utf8_strtolower(utf8_substr(utf8_trim($value), -2, -1));
	}
	
	// multiply by unit
	switch ($unit) {
		case 't':
			$return *= 1024;
		case 'g':
			$return *= 1024;
		case 'm':
			$return *= 1024;
		case 'k':
			$return *= 1024;
	}
	return $return;
}

Best regards,
Lars Knickrehm

The oneye project.

Offline

#14 2012-02-15 01:15:32

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 730
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

redfan9 wrote:

Hey guys, it works fine now... smile

It's so stupid that i forgot to restart the webserver after i change the php.ini configuration.
I was so sleepy at that time when i tested the config and forgot to restart the apache service. When i check again at the phpinfo() i still got 8M at the post_max_size value and i realize that i forgot to restart the service. And after i restart i works fine now.

Thank you s0600204 and also thanks Lars...!!! smile

Good to know - will be fixed in the next release wink !


Best regards,
Lars Knickrehm

The oneye project.

Offline

#15 2012-02-15 01:30:23

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 730
Website

Re: [FIXED] Logout stuck when sound is disabled and can't upload file >8MB

Fixed in revision 7348 . s0600204, please check if you think it's well done this way and reply or commit a better solution.


Best regards,
Lars Knickrehm

The oneye project.

Offline

Board footer

Powered by FluxBB