Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-09 15:50:05

Sandwich
Member
Registered: 2005-02-14
Posts: 37

Why do I have __FUNCTION__ as a class name?

I’m testing out the commenting system. When I try to preview a comment without having filled in a required field, the <txp:comments_error /> function kicks in, and I get the appropriate errors. However, the source looks like this:

<pre><code>&lt;div class=“FUNCTION”>Please enter your name&lt;br>
Please enter a valid email address&lt;br>
You must enter a comment&lt;/div></code></pre>

I searched for underscore-underscore-FUNCTION-underscore-underscore (darn that Textile sometimes!) in the PHP source files, and got these results:

<pre><code>Searching for: FUNCTION
textpattern\publish\taghandlers.php(190): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(291): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(325): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(353): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(439): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(483): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(756): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(789): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(824): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(850): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(884): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(939): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(1301): ‘class’ => FUNCTION,
textpattern\publish\taghandlers.php(1875): ‘class’ => FUNCTION,
Found 14 occurrence(s) in 1 file(s)</code></pre>

Do I have a bad version of <code>taghandlers.php</code>?

Offline

#2 2006-02-09 16:41:45

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Why do I have __FUNCTION__ as a class name?

Taghandlers.php is all right. What it means is that the class assigned to the element will be the same as the function name by default. In this case it should output class=“comments_error”.
But my knowledge of php doesn’t go much further than that, so someone else will have to explain why this doesn’t happen for you :(

Offline

#3 2006-02-13 16:48:15

Sandwich
Member
Registered: 2005-02-14
Posts: 37

Re: Why do I have __FUNCTION__ as a class name?

Hmm. Strange name for a function. Accurate, but strange. :p

Offline

#4 2006-02-14 00:24:19

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Why do I have __FUNCTION__ as a class name?

This is puzzling. PHP should automatically convert the constant __FUNCTION__ to the current function name. Please post your short diagnostics.


Alex

Offline

#5 2006-02-14 06:15:31

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Why do I have __FUNCTION__ as a class name?

Might not be puzzling: what version of PHP is being used? is it less than 4.3.0?

Offline

#6 2006-02-14 07:00:41

Sandwich
Member
Registered: 2005-02-14
Posts: 37

Re: Why do I have __FUNCTION__ as a class name?

Yeah, it is, Mary.

<pre><code>Textpattern version: 4.0.3 (r1188)
last_update: 2006-02-07 09:57:16/2006-02-07 09:56:34
Document root: /web/clients/kokaj/htdocs
$path_to_site: /web/clients/kokaj/htdocs
Textpattern path: /web/clients/kokaj/htdocs/textpattern
Permanent link mode: messy
Temp folder: /web/clients/kokaj/htdocs/textpattern/tmp
Site URL: www.kkcj.org
PHP version: 4.2.1
Register globals: 1
server_time: 2006-02-13 23:56:35
MySQL: 3.23.46
Locale: en_GB
Server: Apache/2.0.39 (Unix) PHP/4.2.1
php_sapi_mode: apache2filter
os_version:

Pre-flight check:
————————————
/web/clients/kokaj/htdocs/textpattern/setup/ still exists
Your version of PHP has security related risks. Please turn register_globals off or update to a newer PHP version.
————————————

.htaccess file contents:
————————————
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php </IfModule>

#php_value register_globals 0

————————————
</code></pre>

Also, the diagnostics page has a couple of errors, as follows (source, so you can see where it is):

<pre><code>&lt;td class=“tabdown2” onclick=“window.location.href=’?event=import’”>&lt;a href=”?event=import” class=“plain”>import&lt;/a>&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>&lt;br>

&lt;b>Warning&lt;/b>: Wrong parameter count for php_uname() in &lt;b>/web/clients/kokaj/htdocs/textpattern/include/txp_diag.php&lt;/b> on line &lt;b>283&lt;/b>&lt;br>
&lt;br>
&lt;b>Warning&lt;/b>: Wrong parameter count for php_uname() in &lt;b>/web/clients/kokaj/htdocs/textpattern/include/txp_diag.php&lt;/b> on line &lt;b>283&lt;/b>&lt;br>

&lt;table id=“list” align=“center” border=“0” cellpadding=“0” cellspacing=“0”>
&lt;tbody>&lt;tr> &lt;td>&lt;h1>Pre-flight check&lt;/h1>&lt;/td></code></pre>

I should add that the server is about to go through an upgrade, so this problem may disappear soon.

Last edited by Sandwich (2006-02-14 08:03:04)

Offline

#7 2006-02-15 06:11:24

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Why do I have __FUNCTION__ as a class name?

There’s your trouble then. :( One of the system requirements for Textpattern is a version of PHP equal to or greater than 4.3.0. The specific problem here is that certain predefined constants are relied upon, which simply didn’t exist in older versions.

In this instance, you can compensate by always passing that “optional” class attribute. As an example, you’d want to make sure you use: <txp:comments_error class="comments_error" />.

You may have other things break though, because older versions of PHP simply aren’t supported. i.e: people may be able to help you find workarounds, but there are no guarantees.

Offline

#8 2006-02-15 06:40:51

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Why do I have __FUNCTION__ as a class name?

certain predefined constants are relied upon, which simply didn’t exist in older versions.

Hey, whaddya know, you’re right. I could’ve sworn FUNCTION was available before 4.3.0.


Alex

Offline

Board footer

Powered by FluxBB