self::

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

self::

Antalóczy Tibor
Hi,
My scripts quit without any error message or any other sign of error as soon as I try to reference a constant defined in the given class with self:: opreator.

class TestController extends Zend_Controller_Action
{
    const constant = 'constant value';

    public function indexAction()
    {
      echo self::constant;
    }
}

Static constants are often referenced this way in ZF, so this holds me back from using such modules as DB or Filters.

I guess my problem is not strictly ZF related, but it has only surfaced in connection with this framework.

Does anyone have any idea on what could cause this problem?
I am using PHP 5.0.5 with Apache 2.x on a debian sarge machine. Is there any extension, that needs to be installed with PHP to get this working?

Thanx in advance

Tibor


Reply | Threaded
Open this post in threaded view
|

Re: self::

Antalóczy Tibor
[it seems that first I have only replied to Katrina, not to the list]

well, that seemed to be a great hint (I kept checking the php.log file, where I was redirecting my php errors). So, apache error.log gets this line when my script is run:
[Wed May 31 01:08:32 2006] [notice] child pid 21879 exit signal Segmentation fault (11)

Nothing particularly surprising, but at least it is a proof that something nasty is going on.

Tibor

Katrina Niolet írta:
Is there anything meaningful in the apache log, by chance?

-----Original Message-----
From: Antalóczy Tibor [hidden email]
Date: Wed, 31 May 2006 01:02:53 
[hidden email]
Subject: Re: [fw-general] self::

Same behaviour, I get a blank page back and no new line in the error log. Even if it worked, I would have to modify Zend Framework at 20+ places to get it running.
 
 Thanx anyway,
 
 Tibor
 
 
 
 Katrina Niolet írta: Does it work normally if you echo: TestController::constant instead? I would think it would... And I imagine would give you the results you are looking for (I might be way off for what what your intentions are, though) --Sent from my Blackberry 8700g -- Katrina Niolet President ILdI Inc. [hidden email] [hidden email] -----Original Message----- From: Antalóczy Tibor <[hidden email]>: [hidden email] Date: Wed, 31 May 2006 00:30:49 [hidden email] [hidden email] Subject: [fw-general] self:
: Hi, My scripts quit without any error message or any other sign of error as soon as I try to reference a constant defined in the given class with self:: opreator. class TestController extends Zend_Controller_Action {     const constant = 'constant value';     public function indexAction()     {       echo self::constant;     } } Static constants are often referenced this way in ZF, so this holds me back from using such modules as DB or Filters. I guess my problem is not strictly ZF related, but it has only surfaced in connection with this framework. Does anyone have any idea on what could cause this problem? I am using PHP 5.0.5 with Apache 2.x on a debian sarge machine. Is there any extension, that needs to be installed with PHP to get this working? Thanx in advance Tibor 
Reply | Threaded
Open this post in threaded view
|

Re: self::

Antalóczy Tibor
In reply to this post by Antalóczy Tibor
PHP 5.1 changelog (http://www.php.net/ChangeLog-5.php#5.1.0) says the following:
   Added support for class constants and static members for internal classes. (Dmitry, Michael Wallner)

Is it possible that the

    const constant = 'constant value';
thing was added only at version 5.1? If so, than it means that Zend Framework is not compatible with PHP versions prior to 5.1

Tibor




Katrina Niolet írta:
Is there anything meaningful in the apache log, by chance?

-----Original Message-----
From: Antalóczy Tibor [hidden email]
Date: Wed, 31 May 2006 01:02:53 
[hidden email]
Subject: Re: [fw-general] self::

Same behaviour, I get a blank page back and no new line in the error log. Even if it worked, I would have to modify Zend Framework at 20+ places to get it running.
 
 Thanx anyway,
 
 Tibor
 
 
 
 Katrina Niolet írta: Does it work normally if you echo: TestController::constant instead? I would think it would... And I imagine would give you the results you are looking for (I might be way off for what what your intentions are, though) --Sent from my Blackberry 8700g -- Katrina Niolet President ILdI Inc. [hidden email] [hidden email] -----Original Message----- From: Antalóczy Tibor <[hidden email]>: [hidden email] Date: Wed, 31 May 2006 00:30:49 [hidden email] [hidden email] Subject: [fw-general] self:
: Hi, My scripts quit without any error message or any other sign of error as soon as I try to reference a constant defined in the given class with self:: opreator. class TestController extends Zend_Controller_Action {     const constant = 'constant value';     public function indexAction()     {       echo self::constant;     } } Static constants are often referenced this way in ZF, so this holds me back from using such modules as DB or Filters. I guess my problem is not strictly ZF related, but it has only surfaced in connection with this framework. Does anyone have any idea on what could cause this problem? I am using PHP 5.0.5 with Apache 2.x on a debian sarge machine. Is there any extension, that needs to be installed with PHP to get this working? Thanx in advance Tibor 
Reply | Threaded
Open this post in threaded view
|

Re: self::

Antalóczy Tibor
In reply to this post by Antalóczy Tibor
thanx, this is what I think the solution could be, too. I was hoping someone using the same php version could draw my attention to a possible solution.
If php 5.1 is really not supported, than this should be expressed on the 'What you will need page' (http://framework.zend.com/faq/installation)

Tibor


Art Hundiak írta:
Upgrade to php 5.1.  Don't know if it's in the official docs yet or not
but Zend  Frameworks will no longer run under 5.0.  Fairly recent
decision.

  
Hi,
My scripts quit without any error message or any other sign of error as
soon as I try to reference a constant defined in the given class with
self:: opreator.

class TestController extends Zend_Controller_Action
{
    const constant = 'constant value';

    public function indexAction()
    {
      echo self::constant;
    }
}

Static constants are often referenced this way in ZF, so this holds me
back from using such modules as DB or Filters.

I guess my problem is not strictly ZF related, but it has only surfaced
in connection with this framework.

Does anyone have any idea on what could cause this problem?
I am using PHP 5.0.5 with Apache 2.x on a debian sarge machine. Is there
any extension, that needs to be installed with PHP to get this working?

Thanx in advance

Tibor