Wedge
Public area => The Pub => Bug reports => Topic started 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.
-
"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?
-
Quotas are set at default of 1024 KB using the default profile. Is this what you want me to add to the code?
$albums = array();
$q = @$allowed_albums[$latest_album]['quota'];
print_r($q)
if (empty($q))
-
Yes. With a ";" at the end of the print_r line, of course. ;)
And then re-do the same action.
-
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.
-
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)
-
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
-
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.
-
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...
-
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:
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):
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.
-
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.
-
Yes, I am still getting the same 8 errors per picture posted to the forum.
-
I'm not asking about these. I'm asking about the strtr error. Please re read my previous post ^^
-
@txcas are you still getting the strtr error? http://wedge.org/pub/bugs/8414/posting-pictures-on-posts-generates-8-errors/msg295208/#msg295208
-
No strtr errors any more, just 8 undefined index errors every time a picture is posted.
-
Bumping this for txcas...
http://wedge.org/pub/bugs/8414/posting-pictures-on-posts-generates-8-errors/msg295208/#msg295208
(Old stuff!)
-
You need to notify @txcas or he will not read your post.
-
My bad. Problem is still there. 8 errors per picture posted.
-
@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..?
-
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.
-
Reply #9 on this topic!
-
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:
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('<' => '<', '>' => '>', '"' => '"'));
$error_message = strtr($error_message, array('<br>' => '<br>', '<b>' => '<strong>', '</b>' => '</strong>', "\n" => '<br>'));
$error_message = preg_replace('~<a href="(.*?)">(.*?)</a>~', '~<a href="$1">$2</a>~', $error_message);
-
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.
-
Okay, so...
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...
-
@txcas any news?
-
2155 errors on my site right now caused by this. I all the debug code again.
-
We debug code in errors.php I getting these:
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.
-
I don't know what I changed in the media settings, but the errors are now gone.
-
I lied, the errors are back.
-
Not seeing the error pop up on my local site... :-/
Tried with regular upload, mass upload, and the usual culprit -- in-post upload.
-
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.
-
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?