Wedge

Public area => The Pub => Bug reports => Topic started by: txcas on February 4th, 2014, 11:41 PM

Title: Posting pictures on posts generates 8 errors
Post by: txcas on February 4th, 2014, 11:41 PM
I finally figured out how to set the Media permissions so users can post pictures.  Pictures are getting posted correctly, but they generate eight errors:

8: Undefined index: doc
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1587

8: Undefined index: video
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
Line: 1587

8: Undefined index: audio
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1587

8: Undefined index: image
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1587

The above errors get repeated on line 1492.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on February 4th, 2014, 11:45 PM
"This never happened before!" (™®)

Nope, can't see why it would happen... What are your quota settings?
Can you do a print_r($q) before line 1471 in core/app/media/Aeva-Gallery.php?
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on February 5th, 2014, 12:10 AM
Quotas are set at default of 1024 KB using the default profile.  Is this what you want me to add to the code?
Code: [Select]
$albums = array();
$q = @$allowed_albums[$latest_album]['quota'];
print_r($q)
if (empty($q))
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on February 5th, 2014, 11:12 AM
Yes. With a ";" at the end of the print_r line, of course. ;)

And then re-do the same action.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on February 5th, 2014, 04:18 PM
That changed the errors to:

8: Undefined index: doc
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1588

8: Undefined index: video
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1588

8: Undefined index: audio
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1588

8: Undefined index: image
File: /home/creedmoo/public_html/sandbox/gz/app/media_Aeva-Gallery.php
 Line: 1588

And the same errors on line: 1493

I can create an admin account for you if you want to take a peek.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on February 5th, 2014, 06:35 PM
Well, didn't it show anything else in the web page..? Or are you copying this from the error log instead?
In which case, please replace `print_r($q);` with `log_error($q);` in the code I gave you! And try again... (No, I don't need the other errors :P)
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on February 5th, 2014, 06:54 PM
The user sees no errors at all and the picture gets posted just fine.  The error log now shows the same 8 errors as before, plus this two:

http://sandbox.65creedmoor.com/?action=media;sa=post;noh=message

2: strtr() expects parameter 1 to be string, array given
File: /home/creedmoo/public_html/sandbox/gz/app/Errors.php
 Line: 39
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on March 2nd, 2014, 04:13 PM
Now that my site is live and members can load pictures to the album, I had over 400 of these errors yesterday.  The pictures are posting, the users see to errors, but we get these errors in the log.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on March 27th, 2014, 10:56 PM
My problem is not in hiding this error (heck it's easy as hell...), but in understanding why it happens in the first place.

I actually made a log_error debug process here and went through uploading pics, and didn't get any errors... OF COURSE.
Perhaps it works fine for admins, and not for others.

I have a feeling that this piece of code is executed twice, and that the problem occurs on phase 2. Other than that... I dunno.
Of course, I can simply just ignore the bug, and proceed with hiding the error. That'd give me more time to work on other things...
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on March 27th, 2014, 11:01 PM
txcas, are you still getting the Errors.php error..? Because that one, I never got to see.

If yes, then please add, before line 39 in that file, something like:

Code: [Select]
if (is_array($error_message)) { log_error(print_r($error_message, true); }

Or this one (it's going to give a long array of esoteric data):

Code: [Select]
if (is_array($error_message)) { log_error(print_r(debug_backtrace(), true); }

Then check your error log, and repost your findings somewhere, either here or by PM... Thanks!
Note: I'm more interesting in the first version, but if $error_message is an empty array or something, then the second version will be the only one that gets me a proper way to debug.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Farjo on March 29th, 2014, 09:34 PM
I used to be able to reproduce this but cannot now. We'll have to see if @txcas is still getting errors with the latest build.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on March 30th, 2014, 05:12 AM
Yes, I am still getting the same 8 errors per picture posted to the forum.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on March 30th, 2014, 10:47 AM
I'm not asking about these. I'm asking about the strtr error. Please re read my previous post ^^
Title: Re: Posting pictures on posts generates 8 errors
Post by: Farjo on June 3rd, 2014, 01:14 PM
@txcas are you still getting the strtr error? http://wedge.org/pub/bugs/8414/posting-pictures-on-posts-generates-8-errors/msg295208/#msg295208
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on June 3rd, 2014, 03:54 PM
No strtr errors any more, just 8 undefined index errors every time a picture is posted.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on June 18th, 2014, 03:18 PM
Bumping this for txcas...

http://wedge.org/pub/bugs/8414/posting-pictures-on-posts-generates-8-errors/msg295208/#msg295208

(Old stuff!)
Title: Re: Posting pictures on posts generates 8 errors
Post by: Farjo on June 19th, 2014, 06:56 PM
You need to notify @txcas or he will not read your post.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on June 19th, 2014, 07:12 PM
My bad.  Problem is still there.  8 errors per picture posted.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on June 20th, 2014, 12:31 PM
@Farjo, I tend to forget that mentions also trigger a notification... :^^;:

@txcas, how exactly can it be fixed, when I didn't do anything for that, precisely because I was waiting for some feedback from you..?

:edit: Then if it's still there (™), why don't you follow the link I gave you..?
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on June 20th, 2014, 03:05 PM
I thought it was fixed because I posted 5 pictures and the error log did not show anything.  But after refreshing the page, there they were, 40 errors.  @Nao isn't the link just pointing to this post?  Let me know what you need and I get it for you.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on June 20th, 2014, 03:31 PM
Reply #9 on this topic!
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on June 20th, 2014, 04:30 PM
I must be doing something wrong.  As soon as I add that line to errors.php the forum stops working.  This is what I have:

Code: [Select]
function log_error($error_message, $error_type = 'general', $file = null, $line = null, $referrer = null)
{
global $settings, $last_error, $context;
static $plugin_dir = null;

// Check if error logging is actually on.
if (empty($settings['enableErrorLogging']))
return $error_message;

// Windows does funny things. Fix the pathing to make sense on Windows.
if ($plugin_dir === null)
$plugin_dir = DIRECTORY_SEPARATOR === '/' ? ROOT_DIR . '/plugins' : str_replace(DIRECTORY_SEPARATOR, '/', ROOT_DIR . '/plugins');

//Added to debug picture posting errors
if (is_array($error_message)) { log_error(print_r($error_message, true); }

// Basically, htmlspecialchars it minus & (for entities!); also save simple links.
$error_message = strtr($error_message, array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
$error_message = strtr($error_message, array('&lt;br&gt;' => '<br>', '&lt;b&gt;' => '<strong>', '&lt;/b&gt;' => '</strong>', "\n" => '<br>'));
$error_message = preg_replace('~&lt;a href=&quot;(.*?)&quot;&gt;(.*?)&lt;/a&gt;~', '~<a href="$1">$2</a>~', $error_message);
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on June 20th, 2014, 05:17 PM
Hmm yeah it's entering an infinite loop.
I have no idea why I suggested that...

I'll have to look into it when i have some time.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on June 21st, 2014, 01:24 AM
Okay, so...

Code: [Select]
if (is_array($error_message))
$error_message = serialize($error_message);

$error_message .= "\n\n" . debug_backtrace(false);

Now it should work, and should give me more interesting results when you get your errors! :)
Once you get a backtrace log, only reproduce the first one here. I guess the following ones will be the same, anyway...
Title: Re: Posting pictures on posts generates 8 errors
Post by: Farjo on November 12th, 2014, 12:00 AM
@txcas any news?
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on November 18th, 2014, 11:12 PM
2155 errors on my site right now caused by this.  I all the debug code again.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on November 20th, 2014, 05:52 PM
We debug code in errors.php I getting these:

Code: [Select]
http://www.65creedmoor.com/?action=media;sa=post;noh=message
8: Undefined index: doc
Array
File: /home/creedmoo/public_html/gz/app/media_Aeva-Gallery.php
Line: 1583
________________
http://www.65creedmoor.com/?action=media;sa=post;noh=message
8: Undefined index: doc
Array
File: /home/creedmoo/public_html/gz/app/media_Aeva-Gallery.php
Line: 1487

The errors repeat for audio and video.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on April 15th, 2015, 08:51 PM
I don't know what I changed in the media settings, but the errors are now gone.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on April 16th, 2015, 04:38 PM
I lied, the errors are back.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on May 5th, 2015, 10:50 AM
Not seeing the error pop up on my local site... :-/
Tried with regular upload, mass upload, and the usual culprit -- in-post upload.
Title: Re: Posting pictures on posts generates 8 errors
Post by: txcas on May 8th, 2015, 09:37 PM
Quote from Nao on May 5th, 2015, 10:50 AM
Not seeing the error pop up on my local site... :-/
Tried with regular upload, mass upload, and the usual culprit -- in-post upload.
It might be something with my host.  Try on my site and you will see it.  Let me know if you need the password.
Title: Re: Posting pictures on posts generates 8 errors
Post by: Nao on May 13th, 2015, 03:57 PM
I don't know. It used to happen on wedge.org, so if it's not happening anymore, there's two possibilities:
- You didn't update all your files correctly, or,
- It only happens in some circumstances, such as uploading a specific file type. I tried with images.
Can you try with images, and then something else?