PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Undefined class constant
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Undefined class constant

Réponse
 
LinkBack Outils de la discussion
Vieux 19/09/2007, 13h56   #1 (permalink)
Puiu Hrenciuc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Undefined class constant

Hi everyone,

I'm having a hard time dealing with an error that appeared overnight
in one of my PHP script:

Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
/#########/classes/framework/HTML/HTMLForm.php on line 120

HTMLForm.php snippet:

..........
// Creates the HTMLFormFields
foreach ($this->Record->Columns as $_column)
{
// Add only visible columns
if ($_column->IsVisible)
{
// Default field type
$_type=HTMLFormField::ELEMENT_TYPE_TEXT ;

// Adjust default type based on Column type
switch ($_column->Type)
{
case Column::TYPE_AUTONUMBER:
$_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
break;

case Column::TYPE_BOOLEAN :
$_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
break;
default:
break;
117: }
118:
119: // Add the column to the list of fields
120: $this->Fields[$_column->Name]=new
121: HTMLFormField($this->Name,$_column,$_type);
122:
123: }

}

As you can see there is no refference to any TYPE_HIDDEN constant
at line 120, nor in the HTMLFormField's constructor.

I searched the net, but I just can't find the reason of this.
Can someone please me ?

Thanks,
Puiu
  Réponse avec citation
Vieux 19/09/2007, 15h04   #2 (permalink)
T . Lensselink
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Undefined class constant

On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc <hpuiu@xentra.ro> wrote:
> Hi everyone,
>
> I'm having a hard time dealing with an error that appeared overnight
> in one of my PHP script:
>
> Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
> /#########/classes/framework/HTML/HTMLForm.php on line 120
>
> HTMLForm.php snippet:
>
> .........
> // Creates the HTMLFormFields
> foreach ($this->Record->Columns as $_column)
> {
> // Add only visible columns
> if ($_column->IsVisible)
> {
> // Default field type
> $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;
>
> // Adjust default type based on Column type
> switch ($_column->Type)
> {
> case Column::TYPE_AUTONUMBER:
> $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
> break;
>
> case Column::TYPE_BOOLEAN :
> $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
> break;
> default:
> break;
> 117: }
> 118:
> 119: // Add the column to the list of fields
> 120: $this->Fields[$_column->Name]=new
> 121: HTMLFormField($this->Name,$_column,$_type);
> 122:
> 123: }
>
> }
>
> As you can see there is no refference to any TYPE_HIDDEN constant
> at line 120, nor in the HTMLFormField's constructor.
>
> I searched the net, but I just can't find the reason of this.
> Can someone please me ?
>
> Thanks,
> Puiu


When the error happens. What are the contents of 120: $_column->Name ?
  Réponse avec citation
Vieux 19/09/2007, 15h13   #3 (permalink)
Puiu Hrenciuc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Undefined class constant

Here are the content for all used variables:

$_this->Name: (string) "FilterForm"
$_column:
StringColumn Object
(
[Table] => Roles
[Name] => RoleName
[Function] => like
[Type] => 4
[Min] =>
[Max] =>
[RegEx] =>
[AllowedValues] => Array
(
)

[IsValid] =>
[IsVisible] => 1
[Sorted] => 0
[Primary] =>
[Foreign] =>
[Negated] =>
[GroupBy] =>
[Aggregate] =>
[_value:protected] =>
)

$_type: (int) 1

T . Lensselink wrote:
> On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc <hpuiu@xentra.ro> wrote:
>> Hi everyone,
>>
>> I'm having a hard time dealing with an error that appeared overnight
>> in one of my PHP script:
>>
>> Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
>> /#########/classes/framework/HTML/HTMLForm.php on line 120
>>
>> HTMLForm.php snippet:
>>
>> .........
>> // Creates the HTMLFormFields
>> foreach ($this->Record->Columns as $_column)
>> {
>> // Add only visible columns
>> if ($_column->IsVisible)
>> {
>> // Default field type
>> $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;
>>
>> // Adjust default type based on Column type
>> switch ($_column->Type)
>> {
>> case Column::TYPE_AUTONUMBER:
>> $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
>> break;
>>
>> case Column::TYPE_BOOLEAN :
>> $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
>> break;
>> default:
>> break;
>> 117: }
>> 118:
>> 119: // Add the column to the list of fields
>> 120: $this->Fields[$_column->Name]=new
>> 121: HTMLFormField($this->Name,$_column,$_type);
>> 122:
>> 123: }
>>
>> }
>>
>> As you can see there is no refference to any TYPE_HIDDEN constant
>> at line 120, nor in the HTMLFormField's constructor.
>>
>> I searched the net, but I just can't find the reason of this.
>> Can someone please me ?
>>
>> Thanks,
>> Puiu

>
> When the error happens. What are the contents of 120: $_column->Name ?

  Réponse avec citation
Vieux 19/09/2007, 15h45   #4 (permalink)
Puiu Hrenciuc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Undefined class constant

Here is the HTMLFormField constructor, it is pretty simple :

/**
* Creates a new HTMLFormField object
*
* @param string $_formName Name of the form this field belongs to
* @param Column $_column Record object this column derives from
* @param int $_type Type of field, this determines the type of
HTML element that will be rendered
* @param string $_class Class name for the HTML element
* @param array $_values Array of display values for combos,
lists, radios
* @param string $_label Label to be displayed next to a radio,
check box
* @param string $_nullMessage Message that will be displayed
when a required field was not filled
* @param string $_invalidMessage Message that will be displayed
when the data entered is invalid
* @param string $_tooShortMessage Message displayed when the
field value is bellow minimum value or length
* @param string $_tooLongMessage Message displayed when the
field value is above maximum value or length
*/
public function
__construct($_formName,$_column=null,$_type=0,$_cl ass=''
,$_fieldValues=null,$_label="",$_nullMessage='',$_ invalidMessage='',$_tooShortMessage='',$_tooLongMe ssage='')
{
// Copy column's properties and save passed parameters
into local properties
if ($_column instanceof Column )
{
$this->Name=$_column->Name;
$this->RegEx=$_column->RegEx;
$this->Min=$_column->Min;
$this->Max=$_column->Max;
$this->Type=$_column->Type;
$this->Value=$_column->Value;
}

$this->FormName=$_formName;
$this->NullMessage=$_nullMessage;
$this->InvalidDataMessage=$_invalidMessage;
$this->TooLongMessage=$_tooShortMessage;
$this->TooLongMessage=$_tooLongMessage;
$this->Class=$_class;
$this->FieldValues=$_fieldValues;
$this->FieldType=$_type;

}

Trust me, it doesn't have any logical explanation

Puiu

T.Lensselink wrote:
> On Wed, 19 Sep 2007 17:13:02 +0300, Puiu Hrenciuc <hpuiu@xentra.ro> wrote:
>
>> Here are the content for all used variables:
>>
>> $_this->Name: (string) "FilterForm"
>> $_column:
>> StringColumn Object
>> (
>> [Table] => Roles
>> [Name] => RoleName
>> [Function] => like
>> [Type] => 4
>> [Min] =>
>> [Max] =>
>> [RegEx] =>
>> [AllowedValues] => Array
>> (
>> )
>>
>> [IsValid] =>
>> [IsVisible] => 1
>> [Sorted] => 0
>> [Primary] =>
>> [Foreign] =>
>> [Negated] =>
>> [GroupBy] =>
>> [Aggregate] =>
>> [_value:protected] =>
>> )
>>
>> $_type: (int) 1
>>
>> T . Lensselink wrote:
>>
>>> On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc <hpuiu@xentra.ro>
>>>

>> wrote:
>>
>>>> Hi everyone,
>>>>
>>>> I'm having a hard time dealing with an error that appeared overnight
>>>> in one of my PHP script:
>>>>
>>>> Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
>>>> /#########/classes/framework/HTML/HTMLForm.php on line 120
>>>>
>>>> HTMLForm.php snippet:
>>>>
>>>> .........
>>>> // Creates the HTMLFormFields
>>>> foreach ($this->Record->Columns as $_column)
>>>> {
>>>> // Add only visible columns
>>>> if ($_column->IsVisible)
>>>> {
>>>> // Default field type
>>>> $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;
>>>>
>>>> // Adjust default type based on Column type
>>>> switch ($_column->Type)
>>>> {
>>>> case Column::TYPE_AUTONUMBER:
>>>> $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
>>>> break;
>>>>
>>>> case Column::TYPE_BOOLEAN :
>>>> $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX
>>>>

>> ;
>>
>>>> break;
>>>> default:
>>>> break;
>>>> 117: }
>>>> 118:
>>>> 119: // Add the column to the list of fields
>>>> 120: $this->Fields[$_column->Name]=new
>>>> 121: HTMLFormField($this->Name,$_column,$_type);
>>>> 122:
>>>> 123: }
>>>>
>>>> }
>>>>
>>>> As you can see there is no refference to any TYPE_HIDDEN constant
>>>> at line 120, nor in the HTMLFormField's constructor.
>>>>
>>>> I searched the net, but I just can't find the reason of this.
>>>> Can someone please me ?
>>>>
>>>> Thanks,
>>>> Puiu
>>>>
>>> When the error happens. What are the contents of 120: $_column->Name ?
>>>

>
> What happens inside the constructor when you create a new instance of
> HTMLFormField?
> Maybe the $_type is validated there. Or i'm missing something in this
> snippet.
>
>
>



  Réponse avec citation
Vieux 19/09/2007, 15h48   #5 (permalink)
T . Lensselink
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Undefined class constant

On Wed, 19 Sep 2007 17:13:02 +0300, Puiu Hrenciuc <hpuiu@xentra.ro> wrote:
> Here are the content for all used variables:
>
> $_this->Name: (string) "FilterForm"
> $_column:
> StringColumn Object
> (
> [Table] => Roles
> [Name] => RoleName
> [Function] => like
> [Type] => 4
> [Min] =>
> [Max] =>
> [RegEx] =>
> [AllowedValues] => Array
> (
> )
>
> [IsValid] =>
> [IsVisible] => 1
> [Sorted] => 0
> [Primary] =>
> [Foreign] =>
> [Negated] =>
> [GroupBy] =>
> [Aggregate] =>
> [_value:protected] =>
> )
>
> $_type: (int) 1
>
> T . Lensselink wrote:
>> On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc <hpuiu@xentra.ro>

> wrote:
>>> Hi everyone,
>>>
>>> I'm having a hard time dealing with an error that appeared overnight
>>> in one of my PHP script:
>>>
>>> Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
>>> /#########/classes/framework/HTML/HTMLForm.php on line 120
>>>
>>> HTMLForm.php snippet:
>>>
>>> .........
>>> // Creates the HTMLFormFields
>>> foreach ($this->Record->Columns as $_column)
>>> {
>>> // Add only visible columns
>>> if ($_column->IsVisible)
>>> {
>>> // Default field type
>>> $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;
>>>
>>> // Adjust default type based on Column type
>>> switch ($_column->Type)
>>> {
>>> case Column::TYPE_AUTONUMBER:
>>> $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
>>> break;
>>>
>>> case Column::TYPE_BOOLEAN :
>>> $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX

> ;
>>> break;
>>> default:
>>> break;
>>> 117: }
>>> 118:
>>> 119: // Add the column to the list of fields
>>> 120: $this->Fields[$_column->Name]=new
>>> 121: HTMLFormField($this->Name,$_column,$_type);
>>> 122:
>>> 123: }
>>>
>>> }
>>>
>>> As you can see there is no refference to any TYPE_HIDDEN constant
>>> at line 120, nor in the HTMLFormField's constructor.
>>>
>>> I searched the net, but I just can't find the reason of this.
>>> Can someone please me ?
>>>
>>> Thanks,
>>> Puiu

>>
>> When the error happens. What are the contents of 120: $_column->Name ?


What happens inside the constructor when you create a new instance of
HTMLFormField?
Maybe the $_type is validated there. Or i'm missing something in this
snippet.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h47.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15640 seconds with 13 queries