php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54162 Code given as argument for non-existing constructor won't execute
Submitted: 2011-03-04 14:06 UTC Modified: 2012-09-08 15:45 UTC
From: mz dot evgeny at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mz dot evgeny at gmail dot com
New email:
PHP Version: OS:

 

 [2011-03-04 14:06 UTC] mz dot evgeny at gmail dot com
Description:
------------
If a class doesn't have a constructor but we pass some arguments into it, then the statements in parentheses won't be executed.

But if we add an empty constructor, it will work as expected.

Test script:
---------------
new stdClass(NOT_EXISTING_FUNCTION());

Expected result:
----------------
Fatal error: Call to undefined function NOT_EXISTING_FUNCTION()


Actual result:
--------------
Nothing. Object was created without errors

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-08 15:45 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-09-08 15:45 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected, as the checking is done in runtime. It's just like: <?php if (0) { foo(); }
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 12:01:29 2025 UTC