php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44523 trying to add a valuable user note, but can't. Line too long after wordwrap??
Submitted: 2008-03-24 20:42 UTC Modified: 2008-03-25 11:22 UTC
From: michel at gopro-tec dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.8 OS: Vista
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 12 = ?
Subscribe to this entry?

 
 [2008-03-24 20:42 UTC] michel at gopro-tec dot com
Description:
------------
Can't post following code-example

Reproduce code:
---------------
Following example takes placeholders formatted like this:
[[name,parameter1,parameter2]] and replaces it with the
 results for function calls: name(parameter1,parameter2).

This enabled me to make websites in a very convenient way.
The @ symbol before the function call surpresses the
 warnings you'd otherwise see on your screen if you'd not 
provide the number of parameters that the function(s) expect.
Let me know what you think. 


<?php

function test($a,$b)
{
  $c=$a*$b;
  if(!$a)$a="NULL";
  if(!$b)$b="NULL";
  return("function <b>test()</b> says if you multiply $a and $b you might end up with $c");
}

function testtwo($a,$b)
{
  $c=$a." ".$b;
  return("function <b>testtwo()</b> says that: ".$c."!");
}

$template="<html><body>[[test]]<br />[[test,17]]<br />[[test,18,3]]<p>[[testtwo,textpad,rocks]]</body></html>";


$template=preg_replace('/\[\[([a-z]+)\,?([0-9a-zA-Z]*)(\,?)([0-9a-zA-Z]*)]]/e','@$1($2 $3 $4)',$template);

print $template;

?>

Expected result:
----------------
post note.

Actual result:
--------------
your text is to long even after wordwrap... ??

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-25 11:22 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The function is being called missing arguments.
See http://docs.php.net/func-get-args

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 02:01:31 2024 UTC