Differences in PHP language support

There are differences in the PHP language support that is provided in CICS® TS Feature Pack for Dynamic Scripting V2.0 compared to the standard PHP runtime.

Differences between the behavior of the PHP language support that is provided in CICS TS Feature Pack for Dynamic Scripting V2.0 and the behavior of running a PHP script on the PHP runtime available from php.net are listed in Table 1. For differences for supported individual PHP functions, see Supported PHP functions.
Table 1. Differences in PHP language support
Description Behavior on php.net Behavior in CICS TS Feature Pack for Dynamic Scripting V2.0 Notes

Notice on array-to-string conversion.

Behavior is inconsistent (5.2.1).

Always outputs notice.

 

Modifying array during foreach loop while it is using &$value syntax.

Behavior is inconsistent (5.2.1).

Changes to array reflect upon $value.

 

Expansion of complex variables inside strings.

$a[0] expands to the value of $a[0], but $a[0][0] expands to Array[0].

Expands to the value of the variable in both cases.

 

Parsing invalid UTF-8 strings htmlentities("Le CafΘ< CafΘ <");.

Ignores just the first xE9 character (e acute in cp1252).

Both xE9 characters are ignored.

 

var_dump of array that contains a reference to a value, where there are no longer any other references to that value.

array(1) { [0]=> &int(123456789) }

(note the ampersand)

array(1) { [0]=> int(123456789) }

A trivial example of a consequence of a garbage-collection model over reference counting. Reference counting here allows php.net to demote a reference to a value when its reference count falls to one, whereas CICS TS Feature Pack for Dynamic Scripting V2.0 has no way of knowing that there is only one reference to the value. This also affects backtrace dumps from Exception objects.

Difference in object handle from var_dump.

object(stdClass)#1 (1) { ["a"]=> int(0) }

object(stdClass)#2 (1) { ["a"]=> int(0) }

Each object has a handle/ID that is exposed by var_dump($object) after the #. sign. CICS TS Feature Pack for Dynamic ScriptingV2.0 might not use the same ID as php.net, where this ID is derived from the way the object is allocated in memory.

Using __FUNCTION__ within an include, within a function declaration.

__FUNCTION__ evaluates to "" (5.2.1).

__FUNCTION__ evaluates to the name of the declaring function.

php.net behavior contradicts the manual entry for include.

Superglobals, ampersands, var_dump, and $GLOBALS.

Superglobals are not preceded by & in $GLOBALS (they are not shown as references) (5.2.1).

Superglobals are preceded by & in $GLOBALS (they are shown as references)

CICS TS Feature Pack for Dynamic Scripting V2.0 handles superglobals by injecting references to them at all scopes, including global scope. Therefore, superglobals are shown as references in $GLOBALS.

Strict warnings when implicitly initializing objects.

$obj->b=1; emits a strict warning but $obj->b[0]=1; does not (5.2.3).

Both $obj->b=1; and $obj->b[0]=1; emit a strict warning.

$obj->b=X and $obj->b[0]=X both implicitly initialize $obj to an instance of stdClass, but in php.net only the first emits the warning: Strict Standards: Creating default object from empty value.

Reference count is greater by one.

$a=array(1); Reference count of element is one.

The reference count is two.

Happens because a variable in CICS TS Feature Pack for Dynamic Scripting V2.0 is created in the data section of the script and has an initial reference count of one. When this is assigned into an array, the reference count is incremented to two.

CICS TS Feature Pack for Dynamic Scripting V2.0 does not support short tags and <script> tags.

     

Parse error messages include language construct not token names.

Parse error: syntax error, unexpected T_FOR in <testcase path> on line 3

Parse error: syntax error, unexpected 'for' in <testcase path> on line 3

 

php.ini is read by using the Java™ platform encoding.

     

property_exists behavior.

php.net 5.2 tries to respect visibility of properties and has bugs. php.net 5.3 ignores scope and visibility.

CICS TS Feature Pack for Dynamic Scripting V2.0 matches php.net 5.3 behavior and matches logic for method_exists function.

 

Static magic methods

php.net 5.3 supports __callStatic. Support for __getStatic, __setStatic, and __issetStatic is also expected to be implemented before release. php.net 5.2 has no support for static magic methods.

CICS TS Feature Pack for Dynamic Scripting V2.0 supports all static magic methods.

These magic methods allow a class to intercept static method calls and static field accesses. They complement their not static equivalents __call, __get, __set, and __isset. __unset has no static equivalent since static variables cannot be unset on a class in the PHP language.

Number of entries in a PHP array

An array can support 2^32 entries, which equals 4,294,967,296.

An array can support 2^31 - 1 entries, which equals 2,147,483,647.

This limit is unlikely to affect your application. Memory limits are normally reached before the number of array entries is reached.

The final context argument that is passed to a user error handler.

Context is always present.

The context parameter contains an array of local variables from the function where the error was raised. InCICS TS Feature Pack for Dynamic Scripting V2.0, the parameter contains an empty array when the error was raised in an optimized function.

Set map_locals=On in php.ini to have standard behavior at a significant cost to performance.