Req #64454 [NEW]: It is possible to directly call the magic method "__construct".
From: wolters dot fl at gmail dot com
Operating system: Microsoft Windows Version 6.2.9
PHP version: 5.4.13
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:It is possible to directly call the magic method "__construct".
Description:
------------
It is possible to directly call the magic method "__construct". This should
NOT be possible, since one cannot create immutable objects with the current
behaviour.
In addition, a direct call to the magic method "__clone" is not possible
and raises an "\E_FATAL". Both magic methods deal with object creation, so
the behaviour is inconsistent between them.
I am using "php-5.4.13-nts-Win32-VC9-x86" on Microsoft Windows Version
6.2.9 x64(Windows 8 64 bit).
Test script:
---------------
https://gist.github.com/FlorianWolters/5195734
Expected result:
----------------
The method call:
$example->__construct();
should raise an "\E_FATAL" with the following message:
"Cannot call __construct() method on objects - use 'new <Class>' instead in
[...] on line 21"
--
Edit bug report at https://bugs.php.net/bug.php?id=64454&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64454&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64454&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64454&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64454&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64454&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64454&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64454&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64454&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64454&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64454&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64454&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64454&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64454&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64454&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64454&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64454&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64454&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64454&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64454&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64454&r=mysqlcfg
Thread (5 messages)
- wolters dot fl at gmail dot com