PHP Classes

lib.uuid integration

Recommend this page to a friend!

      EPub  >  All threads  >  lib.uuid integration  >  (Un) Subscribe thread alerts  
Subject:lib.uuid integration
Summary:uuid creator seems not working
Messages:5
Author:Raqefet A. Yedidia
Date:2011-09-12 18:49:37
Update:2011-09-12 22:47:41
 

  1. lib.uuid integration   Reply   Report abuse  
Picture of Raqefet A. Yedidia Raqefet A. Yedidia - 2011-09-12 18:49:37
Hi,
First, thanks for awesome EPub package. I adopt it for my needs and successfully incorporate it in my e-commerce platform. It works very well.

Lately I try to use the uuid creator (lib.uuid.php) but it seems dysfunctional.

for running the file i set in my book file:
$book->setIdentifier("", "");

this seems to call lib.uuid.php, but it throw an exception - i made a try with your example file, when directly calling it via browser's address line (i.e. not via my platform).

this is the exception message i got (i replaced my site's url with ***):

Fatal error: Uncaught exception 'UUIDException' with message 'Selected version is invalid or unsupported.' in *********/lib.uuid.php:84 Stack trace: #0 *******/EPub.php(1346): UUID::mint(NULL, NULL, '6ba7b811-9dad-1...') #1 *********/EPub.php(1169): EPub->createUUID(4) #2 *********/EPub.Example1.php(168): EPub->finalize() #3 {main} thrown in *********/lib.uuid.php on line 84

any suggestion?

Thanks in advanced,

  2. Re: lib.uuid integration   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2011-09-12 19:33:18 - In reply to message 1 from Raqefet A. Yedidia
Which version of EPub are you using?

The error in your stack trace doesn't make sense. It is understandable that lib.uuid throws an exception with the reported arguments (NULL, NULL, UUID::nsURL) in trace line #0, however that scenario should never be able to occur as createUUID is called with the argument 4 in $version.
As seen in trace line #1.

Cheers
Asbjørn

  3. Re: lib.uuid integration   Reply   Report abuse  
Picture of Raqefet A. Yedidia Raqefet A. Yedidia - 2011-09-12 20:45:52 - In reply to message 2 from Asbjorn Grandt
Thank you for replying so soon.

I use the original files of the latest version of this package (March 14th 2011) for my test (i.e. not altered).
the only change i made was
$book->setIdentifier("", "");
in order to call the uuid creator.
(and I called EPub.Example1.php directly from address line.)

I guess that makes my ePub v 2.0

opf reads (when no changes made):
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" version="2.0">

has it had anything to do with my server? it runs php 5, but i don't know which version... also i'm using a subdomain.



  4. Re: lib.uuid integration   Reply   Report abuse  
Picture of Raqefet A. Yedidia Raqefet A. Yedidia - 2011-09-12 21:14:54 - In reply to message 3 from Raqefet A. Yedidia
OK, i found the source of the error:

in EPub.php

it should be:

function createUUID($ver = 4, $url = NULL) {
include_once("lib.uuid.php");
return UUID::mint($ver,$url,UUID::nsURL);
}


and not:
function createUUID($version = 4, $url = NULL) {

now, running OK and creating UUID


  5. Re: lib.uuid integration   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2011-09-12 22:47:41 - In reply to message 4 from Raqefet A. Yedidia
That explains it quite well I guess :)

I missed it when looking at it today, as it turns out I fixed that bug in the newer versions, the unreleased 2.05, as well as the soon to be released version 2.10.

grandt.com/ePub/EPub-2.10RC4.zip

Still, thanks for pointing it out, I've updated the 2.04 version at this site accordingly.

Cheers
Asbjørn