Dump file

20 views
Skip to first unread message

Bruno Urbano

unread,
Oct 14, 2011, 10:57:18 AM10/14/11
to Jackalope
Hei guys,

I'm try to dump file, but message error is show:

Warning: stream_get_contents() [function.stream-get-contents]:
Jackalope\BinaryStreamWrapper::stream_read is not implemented! in /opt/
www/semarh/jackalope/lib/phpcr/src/PHPCR/PropertyType.php on line 403.

Warning: stream_get_contents() [function.stream-get-contents]:
Jackalope\BinaryStreamWrapper::stream_eof is not implemented! Assuming
EOF in /opt/www/semarh/jackalope/lib/phpcr/src/PHPCR/PropertyType.php
on line 403

Fatal error: Uncaught exception 'PHPCR\RepositoryException' with
message 'Unknown encoding of binary data: jcr-value/
binary;charset=utf-8' in /opt/www/semarh/jackalope/src/Jackalope/
Transport/Jackrabbit/Client.php on line 495

PHPCR\RepositoryException: Unknown encoding of binary data: jcr-value/
binary;charset=utf-8 in /opt/www/semarh/jackalope/src/Jackalope/
Transport/Jackrabbit/Client.php on line 495


I don't understand, why suppose to do? I'm using the example in
tutorial: https://github.com/phpcr/phpcr/blob/master/doc/Tutorial.md.

[Code]
$data = $property->getString(); // read binary into string
echo "Text (size ".$property->getLength()."):\n";
echo $data;

Thanks.

Bruno Urbano.

Lukas Kahwe Smith

unread,
Oct 15, 2011, 6:35:29 AM10/15/11
to Bruno Urbano, Jackalope


David wrote that tutorial. But it seems to me like there might be an issue with autoloading.
Have you tried running the phpcr test suite?

regards,
Lukas Kahwe Smith
sm...@pooteeweet.org

David Buchmann

unread,
Oct 16, 2011, 6:45:58 AM10/16/11
to Lukas Kahwe Smith, Bruno Urbano, Jackalope
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi bruno,

looks weird, especially as it does find the BinaryStreamWrapper
aparently... so not a simple autoloader issue.

how did you set up your testbed? did you use the cmf sandbox?
is this the only example that does not work? is this only an issue about
streams? what version of php do you have on which platform?

what do you get if instead of the $property->getString() line you put a

var_dump($property->getBinary());
var_dump(is_resource($property->getBinary()));
var_dump(get_class($property->getBinary()));

can you check if the file src/Jackalope/BinaryStreamWrapper looks like
https://github.com/jackalope/jackalope/blob/master/src/Jackalope/BinaryStreamWrapper.php

the path in the sandbox would be this:
vendor/symfony-cmf/vendor/doctrine-phpcr-odm/lib/vendor/jackalope/src/Jackalope/BinaryStreamWrapper.php

if its not there or has no stream_read method, there is an issue with
your checkout i think.


cheers,
david

- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6ateYACgkQqBnXnqWBgIsFZgCfY4olh0jJ/UU9ieeg8RwzN9jJ
hFEAoJBJYK6EWhbYZxt9y6kx/qxAnK9u
=zpSR
-----END PGP SIGNATURE-----

David Buchmann

unread,
Oct 17, 2011, 10:41:11 AM10/17/11
to Bruno Urbano, jackal...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi bruno,

hm, this sounds very strange. you seem to have the right classes loaded
but then things fail. really hard to say what is happening here without
playing directly on your machine...

one idea would be to just disable the wrapper. in your bootstrap, add to
your options to the repository factory the following parameter:

'jackalope.disable_stream_wrapper' => true

btw, are you using jackrabbit or doctrine as backend?

cheers,david

ps: you could subscribe to the jackalope-dev mailing list, currently
your emails get into the moderation queue ;-)

Am 17.10.2011 16:08, schrieb Bruno Urbano:
> Hi David,
>
> My system:
>
> - Ubuntu 11.04 - Linux 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28
> 15:05:41 UTC 2011 i686 i686 i386 GNU/Linux
> - PHP Version 5.3.5-1ubuntu7.2
> - Eclipse Helios
>
> I'm using jackalope with this
> tutorial: https://github.com/jackalope/jackalope/wiki/Downloads.
> I could not install cmf sandbox. I tried, but not success.
>
> Result of commands :
>
> var_dump($property->getBinary()); // *resource*(/39/, /stream/)
> var_dump(is_resource($property->getBinary()));// boolean true
> var_dump(get_class($property)); // string 'Jackalope\Property' /(length=18)/
> /
> /
> I checkout the project, but the error persist.
>
> Thanks for feeback. (Sorry, my english so bad)
>
> 2011/10/16 David Buchmann <david.b...@liip.ch
> <mailto:david.b...@liip.ch>>

>> sm...@pooteeweet.org <mailto:sm...@pooteeweet.org>
>
>
>
>

> --

> ----------------------------------------
> Atenciosamente,

> *Bruno Urbano Rodrigues*
> ***http://linkd.in/hJEQgs
> *Analista de Sistemas, MBA
> (62) 9249-6727 (Claro) | 8484-5392 (Oi) | 8202-9603 (Tim)
> <mailto:br...@i3connect.com.br>www.i3connect.com.br
> <http://www.i3connect.com.br/> | br...@i3connect.com.br
> <mailto:br...@i3connect.com.br>


- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6cPoAACgkQqBnXnqWBgIvEPACgyCUsnhLXIZpbipijzbt6ojNz
8s8An1Jxf1Rxq8pdbPi5UWxSmEARZyUq
=tqNp
-----END PGP SIGNATURE-----

Bruno Urbano

unread,
Oct 17, 2011, 10:08:42 AM10/17/11
to David Buchmann, Lukas Kahwe Smith, Jackalope
Hi David,

My system:

- Ubuntu 11.04 - Linux 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:05:41 UTC 2011 i686 i686 i386 GNU/Linux
- PHP Version 5.3.5-1ubuntu7.2
- Eclipse Helios

I'm using jackalope with this tutorial: https://github.com/jackalope/jackalope/wiki/Downloads.
I could not install cmf sandbox. I tried, but not success.

Result of commands :

var_dump($property->getBinary()); // resource(39, stream)

var_dump(is_resource($property->getBinary())); // boolean true
var_dump(get_class($property)); // string 'Jackalope\Property' (length=18)

I checkout the project, but the error persist.

Thanks for feeback. (Sorry, my english so bad)

2011/10/16 David Buchmann <david.b...@liip.ch>
-----BEGIN PGP SIGNED MESSAGE-----



--

----------------------------------------
Atenciosamente,

Bruno Urbano Rodrigues
http://linkd.in/hJEQgs
Analista de Sistemas, MBA
(62) 9249-6727 (Claro) | 8484-5392 (Oi) | 8202-9603 (Tim)

Bruno Urbano

unread,
Oct 17, 2011, 1:32:17 PM10/17/11
to Jackalope
Hi David,

I'm using jackrabbit.
I disable the wrapper and error is change, see:

Fatal error: Uncaught exception 'PHPCR\RepositoryException' with
message 'Unknown encoding of binary data: jcr-value/
binary;charset=utf-8' in /opt/www/semarh/jackalope/src/Jackalope/
Transport/Jackrabbit/Client.php on line 416

PHPCR\RepositoryException: Unknown encoding of binary data: jcr-value/
binary;charset=utf-8 in /opt/www/semarh/jackalope/src/Jackalope/
Transport/Jackrabbit/Client.php on line 416

Any idea ? Thansk for help.
> > 2011/10/16 David Buchmann <david.buchm...@liip.ch
> > <mailto:david.buchm...@liip.ch>>
>
> > hi bruno,
>
> > looks weird, especially as it does find the BinaryStreamWrapper
> > aparently... so not a simple autoloader issue.
>
> > how did you set up your testbed? did you use the cmf sandbox?
> > is this the only example that does not work? is this only an issue about
> > streams? what version of php do you have on which platform?
>
> > what do you get if instead of the $property->getString() line you put a
>
> > var_dump($property->getBinary());
> > var_dump(is_resource($property->getBinary()));
> > var_dump(get_class($property->getBinary()));
>
> > can you check if the file src/Jackalope/BinaryStreamWrapper looks like
> >https://github.com/jackalope/jackalope/blob/master/src/Jackalope/Bina...
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

David Buchmann

unread,
Oct 18, 2011, 9:30:11 AM10/18/11
to Bruno Urbano, jackal...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi bruno,

hm, now this is interesting. my jackrabbit uses the mime type
"jcr-value/binary; charset=utf-8" with a space after the ;.

can you please try with the latest jackrabbit we built for jackalope?
https://s3-eu-west-1.amazonaws.com/patched-jackrabbit/jackrabbit-standalone-2.3.1-jackalope-SNAPSHOT.jar
it contains a few patches that are needed and will make it into
jackrabbit core soon.

(note to self: if this is the problem, check the jackrabbit version in
the client and say something meaningful...)

can you try to run the tests, too? see for a guide:
https://github.com/jackalope/jackalope/wiki/Setup-with-jackrabbit

if the problem does not go away with the right jackrabbit, would be
interesting to know what fails and what not.

cheers,david

Am 17.10.2011 19:32, schrieb Bruno Urbano:
> Hi David,
>

iEYEARECAAYFAk6df2MACgkQqBnXnqWBgIvxlgCfRAsW3fE2yWk2nqPnigWmweLG
/uMAnRcwDJB4agRvX0vFk+Rg6WGePTfU
=9qeX
-----END PGP SIGNATURE-----

Bruno Urbano

unread,
Mar 6, 2012, 1:32:01 PM3/6/12
to jackal...@googlegroups.com
Hi David,

It's works. But i change the file Jackalope\Transport\Jackrabbit\Client.php in function getBinaryStream($path).
My mimeType is the same "jcr-value/binary; charset=utf-8" with a space after the ;. that you told me.
I remove space and the jackalope dump file without error.

I post message to group for register. Thank's for help.

My code is:

            if(!is_null($this->session->getNodeByIdentifier($value)))
                 $file = $this->session->getNodeByIdentifier($value);
            else $file = $this->session->getPath($value);

            $content = $file->getNode('jcr:content');
            $mimeType = $content->getPropertyValue('jcr:mimeType');
            $data = $content->getProperty('jcr:data');
            $size = $data->getLength();
            $nameFile = $file->getName();
            $stream = $data->getBinary(); // get binary stream
           
            //Cria um arquivo temporario - Create a temp file prefix GED
            $temp_file = tempnam(sys_get_temp_dir(), 'GED');
           
            //Transfere o resource(stream) para o arquivo temporario - dump resource to temp file
            $handle = fopen($temp_file, "wb");
            fwrite($handle, stream_get_contents($stream));
            fclose($handle);
           
            //Remete o downloado do arquivo - force download
            header("Content-Type: $mimeType");
            header("Content-Length: ".(string)($size));
            header("Content-Disposition: inline; filename=$nameFile");
            header("Content-Transfer-Encoding: binary");
            readfile($temp_file);
           
            //Remove o arquivo temporario do servidor - remove temp file
            unlink($temp_file);


Thank's.
Hi David,
Hi David,

David Buchmann

unread,
Mar 7, 2012, 2:19:48 PM3/7/12
to Bruno Urbano, jackal...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi bruno,

this is quite surprising indeed. i would have thought jackrabbit using
the same mime type line.
https://github.com/jackalope/jackalope-jackrabbit/blob/master/src/Jackalope/Transport/Jackrabbit/Client.php#L494

i guess both mime types are valid but so far being lazy worked for us.

can you please open an issue at
https://github.com/jackalope/jackalope-jackrabbit/ with your example and
clarify:

* does it happen with a fresh install of jackrabbit 2.4 on a new repository?
* how do you load the data into the repository?
* do you know a way to reproduce?
* what version of java and what operating system are you using?

this might help to understand what is going wrong...
maybe we just need to properly parse the mime type and act accordingly.
then we could also handle different encodings than utf-8, no clue if
that could happen too.

cheers,david

ps: a comment on your code. it could be simplified a lot - you don't
need to copy the stream around:

use PHPCR\Util\UUIDHelper;

if UUIDHelper::isUUID($value) {


$file = $this->session->getNodeByIdentifier($value);
} else {

$file = $this->session->getNode($value);
}

$content = $file->getNode('jcr:content');
$mimeType = $content->getPropertyValue('jcr:mimeType');
$data = $content->getProperty('jcr:data');
$size = $data->getLength();
$nameFile = $file->getName();
$stream = $data->getBinary(); // get binary stream

//Remete o downloado do arquivo - force a download
header("Content-Type: $mimeType");
header("Content-Length: $size");


header("Content-Disposition: inline; filename=$nameFile");
header("Content-Transfer-Encoding: binary");

fpassthru($stream);

//Remove o arquivo temporario do servidor

stream_close($stream);

did you see the phpcr tutorial? it has this example for the stream and
many other interesting samples:
https://github.com/phpcr/phpcr/blob/master/doc/Tutorial.md

Am 06.03.2012 19:17, schrieb Bruno Urbano:
> Hi, David
>
> I change the file Jackalope\Transport\Jackrabbit\Client.php in
> function
> getBinaryStream($path). My jackrabbit uses the mime type
> "jcr-value/binary; charset=utf-8" with a space after the ;. the same
> that you told me, I change de value to "jcr-value/
> binary;charset=utf-8" without space and work's.
>
> I'm using Jackalope from the branch master | ->
> https://github.com/jackalope/jackalope-jackrabbit
> and Jackrabbit 2.4.0
>
> My code to dump file is:


>
>
> if(!is_null($this->session->getNodeByIdentifier($value)))
> $file = $this->session->getNodeByIdentifier($value);
> else $file = $this->session->getPath($value);
>
> $content = $file->getNode('jcr:content');
> $mimeType = $content->getPropertyValue('jcr:mimeType');
> $data = $content->getProperty('jcr:data');
> $size = $data->getLength();
> $nameFile = $file->getName();
> $stream = $data->getBinary(); // get binary stream
>

> //Cria um arquivo temporario - Create da temp file


> $temp_file = tempnam(sys_get_temp_dir(), 'GED');
>
> //Transfere o resource(stream) para o arquivo temporario - dump

> resource to a temp file;


> $handle = fopen($temp_file, "wb");
> fwrite($handle, stream_get_contents($stream));
> fclose($handle);
>

> //Remete o downloado do arquivo - force a download


> header("Content-Type: $mimeType");
> header("Content-Length: ".(string)($size));
> header("Content-Disposition: inline; filename=$nameFile");
> header("Content-Transfer-Encoding: binary");
> readfile($temp_file);
>
> //Remove o arquivo temporario do servidor

> unlink($temp_file);
>
>
> Thank's for help.


>
> On 18 out 2011, 10:30, David Buchmann <david.buchm...@liip.ch> wrote:
> hi bruno,
>

> hm, now this is interesting. my jackrabbit uses the mime type
> "jcr-value/binary; charset=utf-8" with a space after the ;.
>

> can you please try with the latest jackrabbit we built for jackalope?https://s3-eu-west-1.amazonaws.com/patched-jackrabbit/jackrabbit-stan...

>>>>>>> can you check if thefilesrc/Jackalope/BinaryStreamWrapper looks like


>>>>>>> https://github.com/jackalope/jackalope/blob/master/src/Jackalope/Bina...
>
>>>>>>> the path in the sandbox would be this:
>>>>>>> vendor/symfony-cmf/vendor/doctrine-phpcr-odm/lib/vendor/jackalope/src/Jacka lope/BinaryStreamWrapper.php
>
>>>>>>> if its not there or has no stream_read method, there is an issue with
>>>>>>> your checkout i think.
>
>>>>>>> cheers,
>>>>>>> david
>
>>>>>>> Am 15.10.2011 12:35, schrieb Lukas Kahwe Smith:
>
>>>>>>>> On Oct 14, 2011, at 16:57 , Bruno Urbano wrote:
>
>>>>>>>>> Hei guys,
>

>>>>>>>>> I'm try todumpfile, but message error is show:

iEYEARECAAYFAk9XtNAACgkQqBnXnqWBgIv4zwCggWCNdPZmoWdDVQjxVhief7k+
jPAAniMB+hfc1pCvOmxFV+F3Qwba+We5
=FaDA
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages