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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC