Privatebin: The link redirects to the index

Created on 3 May 2017  ·  12Comments  ·  Source: PrivateBin/PrivateBin


Steps to reproduce

  1. Create a paste
  2. Use the link to access it

What happens

Redirect to index

What should happen

Redirect to the paste

Additional information


PDO : pgsql
Php error : PHP Warning: strlen() expects parameter 1 to be string, resource given in path/privatebin/lib/Data/Database.php on line 250

Basic information


Server address: http://privatebin.delurk.com


Server OS: Debian 8


Webserver: Apache 2.4.10


Browser: Firefox Developer Edition 54


PrivateBin version: Release 1.1

bug

All 12 comments

That's interesting. I could reproduce the issue on your server. However, there is no real redirect, it just shows the home page instead of loading the paste…

Did you try another database/storage system, so is it connected to the database you use?

The error points to this line indicating that it might be connected to attachments.

  1. As attachments are disabled on your server, could you please enable them (temporarily) and test whether thee is a different result with attachments.
  2. Could you either look into the database and check that the data is really saved there? (OR)
  3. Just add var_dump($paste);exit; (temporarily) before line 240 in the file with the error, which should output the content of the paste.

I assume the data PrivateBin cannot save the data in your database correctly…

I didn't try another storage system.

  1. Attachments are now enabled.
  2. Data are saved : export.csv from database (link removed)
  3. Done

Okay, could you please revert 3.?
Are you still using the filesystem based storage? If so could you just confirm, this storage method works and then switch back to the problematic database storage?

I remove the dump in Database.php

I didn't change the Database type. This is a PostgreSQL database from start.

Ah, okay. That's strange…
So the data is saved, but not shown correctly…

BTW on https://delurk.com/ I get the error SSL_ERROR_RX_RECORD_TOO_LONG.

In my test adding an attachments did not change the result. Is there any difference in the error of the server log?

SLL isn't still available.

Nothing more in logs since attachements are enabled. If I put it off and comment the attachement part in Database.php, the logs stay empty.

In another hand, if I use flat file storage system it works.

Did you create the tables manually (via description in INSTALL.md) or did you let PrivateBin create the tables for you? In PostgreSQL the attachment column needs to be TEXT and not BLOB or MEDIUMBLOB (see line 579 in Database.php). I suspect that otherwise, a stream instead of a string gets returned, as per PDOs LOB handling.

I create tables manually over INSTALL.md but I change BLOB to BYTEA because that was suggested in pgsql documentation https://www.postgresql.org/docs/9.1/static/datatype-binary.html

TEXT works great so thanks for all.

So is this issue solved or does someone think the doc or some code needs to be updated? (to clarify something or so?)

It's solved. You can add this in INSTALL.md :

In PostgreSQL the attachment column needs to be TEXT and not BLOB or MEDIUMBLOB

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hardware picture hardware  ·  4Comments

aryasenna picture aryasenna  ·  7Comments

elrido picture elrido  ·  3Comments

Kcchouette picture Kcchouette  ·  5Comments

pstray picture pstray  ·  7Comments