PHP Classes

errors

Recommend this page to a friend!

      SForm  >  All threads  >  errors  >  (Un) Subscribe thread alerts  
Subject:errors
Summary:I got a few errors in PHP 5.0.5 on Windows XP
Messages:2
Author:rudie dirkx
Date:2006-10-26 07:14:10
Update:2006-10-26 22:56:56
 

  1. errors   Reply   Report abuse  
Picture of rudie dirkx rudie dirkx - 2006-10-26 07:14:10
Hi,

I got a few errors. Three I think... Two were nasty!

1. interface Countable didn't exist! Maybe you use a newer PHP or an extension in which its loaded automatically, but I dont. So I created it myself
[code]<?php
interface Countable
{
function count();
}
?>[/code]
-- Error fixed

2. index SCRITP_URL doesnt exist. It was used for the attribute action in the form tag. My $_SERVER array doesn't contain SCRIPT_URL, so I made it, using SCRIPT_NAME from the _SERVER array.
[code]<?php
$_SERVER['SCRIPT_URL'] = $_SERVER['SCRIPT_NAME'];
?>[/code]
-- Error fixed

3. public function Display in class SForm (extending SForm_Container) takes a parameter of form SForm_Renderer. Your default value was NULL. It can;t be null, since that's not a valid form of SForm_Renderer! But it's not called with a parameter, so it must have a default. So I deleted the 'reference' to its form SForm_Renderer.
Codes:
it was:
[code]<?php
public function display( SForm_Renderer $rend = null )
?>[/code]
and it is now
[code]<?php
public function display( $rend = null )
?>[/code]
-- Error fixed


Great class though :)
Just curious about the interface Countable and your PHP version...

  2. Re: errors   Reply   Report abuse  
Picture of Seth Price Seth Price - 2006-10-26 22:56:56 - In reply to message 1 from rudie dirkx
Ah, those are differences between PHP 5.0 and 5.1. I've incorporated your suggestions into SForm.php, tell me if it works better for you.
Thanks,
Seth