php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57744 HaruDoc does not implement __toString()
Submitted: 2007-07-13 04:17 UTC Modified: 2013-02-18 00:35 UTC
From: pcdinh at gmail dot com Assigned:
Status: No Feedback Package: haru (PECL)
PHP Version: 5.2.1 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pcdinh at gmail dot com
New email:
PHP Version: OS:

 

 [2007-07-13 04:17 UTC] pcdinh at gmail dot com
Description:
------------
HaruDoc class does not implement __toString() method so it is impossible for developers to look at its current internal information when do debugging.

Reproduce code:
---------------
<?php

$doc = new HaruDoc();

$doc->setPageMode(HaruDoc::PAGE_MODE_USE_THUMBS); /* show thumbnails */

$page = $doc->addPage(); /* add page to the document */
$page->setSize(HaruPage::SIZE_A4, HaruPage::LANDSCAPE); /* set the page to use A4 landscape format */

$courier = $doc->getFont("Courier-Bold"); /* we'll use the bundled font a few lines below */

$page->setRGBStroke(0, 0, 0); /* set colors */
$page->setRGBFill(0.7, 0.8, 0.9);
$page->rectangle(150, 150, 550, 250); /* draw a rectangle */

$page->fillStroke(); /* fill and stroke it */

$page->setDash(array(3, 3), 0); /* set dash style for lines at this page */
$page->setFontAndSize($courier, 60); /* set font and size */

$page->setRGBStroke(0.5, 0.5, 0.1); /* set line color */
$page->setRGBFill(1, 1, 1); /* set filling color */

$page->setTextRenderingMode(HaruPage::FILL_THEN_STROKE); /* fill and stroke text */

/* print the text */
$page->beginText();
$page->textOut(210, 270, "Hello World!");
$page->endText();

$doc->save(dirname(__FILE__)."/test.pdf"); /* save the document into a file */

echo $doc; // Cachable fatal error

?> 

Expected result:
----------------
It would be useful to see something useful when developer try to convert it into a string.

Actual result:
--------------
Cachable fatal error occurs.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-13 04:26 UTC] tony2001 at phpclub dot net
>It would be useful to see something useful
Define "something". "HaruPDF document" - is this useful enough?
How do you see a PDF document (with images, annotations, graphics etc) converted to a string?
Also please remember that we're limited to the API libharu provides: http://libharu.sourceforge.net/api_reference.html
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC