0

My script is dies at the start when I try to devine a SplFixedArray and I don't know how to find the error. Help would be appreciated...

<?
        error_reporting( E_ALL ); 
        // Initialize the array with a fixed length
        $array = new SplFixedArray(5);

Thanks!
WBR

4
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by rouse
0

I tried it and I had the same problem. I checked php.ini and I had the extension disabled (php_spl_types.dll) so I changed that but it still didn't work. I checked and the extension is in the Ext directory. It should work but it is still giving the same error.

0

Are you able to generate an error message of some kind, if so how?

0

Two things immediately jump to mind, are short php start tags enabled? Also are you using a version of php > 5.3.0?

0

In my case (since it isn't working for me either), I changed the short open tag when I tried it. I am running PHP 5.2.10 but my understanding is that it should still run.

According to PHP.net
This extension is available and compiled by default in PHP 5.0.0.
As of PHP 5.3.0 this extension can no longer be disabled and is therefore always available.

0

I'm running 5.2.8. I also set shorto_open_tag to Off, but that was of no value.
I am moving up to 5.3 now but as "chrishea" pointed out the docs say it should work with 5.0.0

0

All of the documentation indicates that SplFixedArray methods have a >= 5.3.0 requirement. Works without issue on 5.3.5 and 5.3.6 here.

2

PHP 5.2.11 on Win.

Defined classes prefixed with "Spl" are:

SplFileInfo
SplFileObject
SplTempFileObject
SplObjectStorage

When enabling php_spl_types extension:

SplType
SplEnum
SplBool
SplInt
SplFloat

are added.

I'm using this to get the classes:

$classes = get_declared_classes();
foreach($classes as $class) {
   if (strpos($class, 'Spl') !== false) echo $class . "\n"; 
}

It looks like 'SplFixedArray' isn't included before 5.3.0?

Votes + Comments
we're not worthy!
Very logical approach to determining the answer. Good work.
0

Digital-Ether: Your approach to determining the answer is very intelligent. Should have thought of doing something like that (but of course, I didn't!). Good work.

0

Digital-Ether:
Thanks for your help.

As a not so side note for me, I cannot seem to get version 5.3 of PHP running on my machine, so I will start a new note.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.