Media - undefined variable, xref, SVN8658

Bug #591232 reported by ToyGuy
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
webtrees
Fix Released
Medium
fisharebest

Bug Description

When deleting a media OBJE using Manage Multimedia, we receive the following missing variable error:

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php

Notice: Undefined variable: xref in /Library/WebServer/Documents/webtrees/media.php on line 599

-Stephen

Revision history for this message
HRN (hhrrnn) wrote :

Related?

In Mediaviewer i get this error on all media:

                             The image relates to:

ERROR 8: Undefined variable: SHOW_LAST_CHANGE
0 Error occurred on line 148 of file mediaviewer.php
Notice: Undefined variable: SHOW_LAST_CHANGE in /hsphere/local/home/mysi/mysite.com/webtree/mediaviewer.php on line 148

Revision history for this message
windmillway (windmillway) wrote :

I am studying this now, but it has been a long day.
Am also an old farted, retired pensioner, who tends to take longer and longer for things to sink in. <grin>
Not promising anything, but just to say I am looking.

Brian

Revision history for this message
fisharebest (fisharebest) wrote :

@HRN - I think this is unrelated, and was fixed a few releases ago

Revision history for this message
fisharebest (fisharebest) wrote :

@ToyGuy - is this an external media object (i.e. a URL to an image?)

Revision history for this message
ToyGuy (toyguy) wrote :

Nope - it was a regular photo image, but a duplicate image with a different file name.
stephen

Revision history for this message
windmillway (windmillway) wrote :

Greg,
I have the same problem.
It happens for URL items AND locally uploaded images via the Add new media item on the Manage Multimedia page.
However, everything seems to be done properly ref the delete, it is just the silly error message.

This is the message in full.

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php

Notice: Undefined variable: xref in /Applications/MAMP/htdocs/webtrees_8643/media.php on line 599
Media file successfully deleted.
Thumbnail file successfully deleted.
Record M12 successfully removed from GEDCOM.
Update successful

Brian

Revision history for this message
ToyGuy (toyguy) wrote :

Brian
But did you check? The error message quotes Update Successful - but mine was NOT. The item was still on the manage media list, with its Mnnn number, and the thumb still displayed - but no longer connected to any INDI/FAM.
Stephen

Revision history for this message
fisharebest (fisharebest) wrote :

I've tried adding and removing media objects, media files, etc., and don't see any error messages.

Revision history for this message
windmillway (windmillway) wrote :

Yes Stephen,

I had the media firewall directory open in my "finder viewer", and I saw the item dissapear so I know it was deleted.
The item also disappeared form the Manage Media list.

Brian

Revision history for this message
ToyGuy (toyguy) wrote :

Maybe it was a one off, as I haven't retested. Go ahead and close this and let's see if it pops up again.
Stephen

Revision history for this message
kiwi (kiwi3685-deactivatedaccount) wrote :

There's no actual way to "close" bugs here, so I have marked it as "invalid" - no reflection on your intent Stephen :-(

Changed in webtrees:
status: New → Invalid
Revision history for this message
fisharebest (fisharebest) wrote :

Reopened - the same bug has been raised in the latest SVN code

Changed in webtrees:
status: Invalid → New
Revision history for this message
fisharebest (fisharebest) wrote :

I still cannot reproduce this bug.

The only way to reach this block of code is when deleting a file (action=deletefile), and this action also sets xref. So, I don't see how to recreate this "xref undefined" error.

@HRN - can you confirm that you are able to reproduce this error?

Changed in webtrees:
status: New → Incomplete
Revision history for this message
HRN (hhrrnn) wrote :

Yes
Added new media file - OK
Manage multimedia -> Remove object

I get:
ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php
Notice: Undefined variable: xref in /hsphere/local/home/mysi/webtree.mysite.com/webtree/media.php on line 599 Record I2141 successfully updated.
Record M13 successfully removed from GEDCOM.
Update successful

Item still on media list and thumbnail displayed.

Delete file -> I get:

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php
Notice: Undefined variable: xref in /hsphere/local/home/mysi/webtree.mysite.com/webtree/media.php on line 599 Media file successfully deleted.
Thumbnail file successfully deleted.
Record I2141 successfully updated.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'old_gedcom' cannot be null' in /hsphere/local/home/mysi/webtree.mysite.com/webtree/includes/classes/class_wt_db.php:352 Stack trace: #0 [internal function]: PDOStatement->execute(Array) #1 /hsphere/local/home/mysi/webtree.mysite.com/webtree/includes/classes/class_wt_db.php(352): call_user_func_array(Array, Array) #2 [internal function]: WT_DBStatement->__call('execute', Array) #3 /hsphere/local/home/mysi/webtree.mysite.com/webtree/includes/functions/functions_edit.php(372): WT_DBStatement->execute(Array) #4 /hsphere/local/home/mysi/webtree.mysite.com/webtree/media.php(692): delete_gedrec('M13', '9') #5 {main} thrown in /hsphere/local/home/mysi/webtree.mysite.com/webtree/includes/classes/class_wt_db.php on line 352

File is deleted from media folder, and everything looks fine . Except this error message

Revision history for this message
fisharebest (fisharebest) wrote :

I still can't reproduce this.

Do you have auto-accept enabled? If so, at which point(s) do you accept changes.

Revision history for this message
HRN (hhrrnn) wrote :

Auto accept disabled, default settings. Same in SVN 8956

Revision history for this message
fisharebest (fisharebest) wrote :

I should have asked "if not", rather than "if so".

At what, if any, points do you accept pending changes?

Can you also post the URLs at each step in the process?

I'm sure this is one of those things that will take 10 seconds to fix, once I've managed to reproduce it.....

Revision history for this message
HRN (hhrrnn) wrote :
Download full text (4.0 KiB)

Indi page -> Media tab -> Add new media item -> adding testimage.jpg (title:Test)

Thumbnail media/thumbs/testimage.jpg generated automatically.
Update successful
Close Window

Pending changes -> Accept all changes

Review GEDCOM changes
Changes successfully accepted into database
There are currently no changes to be reviewed.
Close Window

My page -> Manage multimedia (http://webtree.mysite.com/webtree/media.php)

Sequence: Title
Filter: Test -> Filter

Media file with tumbnail displayed

Klick Remove object (http://webtree.mysite.com/webtree/media.php?filter=Test&action=removeobject&showthumb=true&sortby=title&filter=Test&subclick=search&filename=*nZ3U0NZm5s7W2KDZ083HXprlyg##&directory=media/&level=0&xref=M331&gedfile=9)

Page reloads with:

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php
Notice: Undefined variable: xref in /hsphere/local/home/mysi/webtree.mysite.com/webtree/media.php on line 599 Record I2141 successfully updated.
Record M331 successfully removed from GEDCOM.
Update successful

No indication of pending changes after reload.

-> Homepage -> Pending changes -> Accept all changes:

Review GEDCOM changes
ERROR: Invalid gedcom record.Changes successfully accepted into database
There are currently no changes to be reviewed.
Close Window

Close Window does not reload page. Pending changes still indicated

Click Pending changes:

Review GEDCOM changes
There are currently no changes to be reviewed.
Close Window

Close Window does not reload page. Have to Reload on browser. Pending changes disappears

My page -> Manage multimedia (http://webtree.mysite.com/webtree/media.php)

Sequence: Title
Filter: Test -> Filter

Media file with tumbnail displayed

Klick Delete file (http://webtree.mysite.com/webtree/media.php?filter=Test&action=deletefile&showthumb=true&sortby=title&filter=Test&subclick=search&filename=*nZ3U0NZm5s7W2KDZ083HXprlyg##&directory=media/&level=0&xref=M331&gedfile=9)

Page reloads with:

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php
Notice: Undefined variable: xref in /hsphere/local/home/visitusi/webtree.visitusinmaputo.com/webtree/media.php on line 599 Media file successfully deleted.
Thumbnail file successfully deleted.
Record M331 successfully removed from GEDCOM.
Update successful

Thumbnail not displayed (replaced by multimedia icon) and Media info:

Test (M331)
media/testimage.jpg
The filename entered does not exist.
 Image Dimensions -- 300x300

This media object is not linked to any GEDCOM record.

I do have following choice:

Edit
Edit raw GEDCOM record
Delete file
Remove object
Manage links

Clicking Delete file onece again (http://webtree.mysite.com/webtree/media.php?filter=Test&action=deletefile&showthumb=1&sortby=title&filter=Test&subclick=search&filename=*nZ3U0NZm5s7W2KDZ083HXprlyg##&directory=media/&level=0&xref=M331&gedfile=9)

I get:

ERROR 8: Undefined variable: xref
0 Error occurred on line 599 of file media.php
Notice: Undefined variable: xref in /hsphere/local/home/mysi/webtree.mysite.com/webtree/media.php on line 599 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 10...

Read more...

Revision history for this message
fisharebest (fisharebest) wrote :

Thanks for this. Got there at last.

There is some code (inherited from PGV) that "encrypts" filenames, when passing them as URLs.

The algorithm generates encrypted names that may contain '#' characters - and these cause the rest of the URL to be ignored....

So, the reason I couldn't see the error is down to choice of filename. My one was encrypted to a string that did not include '#'.

This encryption is present so that we can bypass some "hacker detection" code in session_spider. I was never happy with this hacker detection code. It was simply a cover for badly escaped strings elsewhere in the code, and I have already disabled it.

Fix submitted.

BTW - the problem "Column 'old_gedcom' cannot be null" is unrelated. I am working on this now....

Changed in webtrees:
assignee: nobody → fisharebest (fisharebest)
importance: Undecided → Medium
status: Incomplete → Fix Committed
Changed in webtrees:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.