[php-maint] Bug#498914: php5-cli: Class-named functions are treated as constructors, but only in included files

Patrik Fimml patrik at fimml.at
Sun Sep 14 14:03:00 UTC 2008

Package: php5-cli
Version: 5.2.6-3
Severity: normal

When defining a function with the same name as the enclosing class, it
is treated as a constructor for backwards-compatibility. However, if
there is a __construct() function, it should be ignored.

PHP handles this correctly when the class is defined in a script file
that is directly executed, but reports an error (two constructors) if
the class comes from an included file.

With the two attached files in the same directory, I get the following

% php a.php

% php test.php
> Strict standards: Redefining already defined constructor for class A in /tmp/a.php on line 8
> Call Stack:
>     0.0002     106840   1. {main}() /tmp/test.php:0

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (800, 'testing'), (200, 'unstable'), (50, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages php5-cli depends on:
ii  libbz2-1.0            1.0.5-1            high-quality block-sorting file co
ii  libc6                 2.7-13             GNU C Library: Shared libraries
ii  libcomerr2            1.41.0-3           common error description library
ii  libdb4.6              4.6.21-8           Berkeley v4.6 Database Libraries [
ii  libkrb53              1.6.dfsg.4~beta1-4 MIT Kerberos runtime libraries
ii  libmagic1             4.25-1             File type determination library us
ii  libncurses5           5.6+20080830-1     shared libraries for terminal hand
ii  libpcre3              7.6-2.1            Perl 5 Compatible Regular Expressi
ii  libssl0.9.8           0.9.8g-13          SSL shared libraries
ii  libxml2               2.6.32.dfsg-3      GNOME XML library
ii  mime-support          3.44-1             MIME files 'mime.types' & 'mailcap
ii  php5-common           5.2.6-3            Common files for packages built fr
ii  tzdata                2008e-3            time zone and daylight-saving time
ii  ucf                   3.007              Update Configuration File: preserv
ii  zlib1g                1:  compression library - runtime

php5-cli recommends no packages.

Versions of packages php5-cli suggests:
ii  php-pear                      5.2.6-3    PEAR - PHP Extension and Applicati

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.php
Type: application/x-httpd-php
Size: 110 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20080914/285fb73a/attachment.php 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.php
Type: application/x-httpd-php
Size: 64 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20080914/285fb73a/attachment-0001.php 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20080914/285fb73a/attachment.pgp 

More information about the pkg-php-maint mailing list