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
 [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-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 29 02:03:33 2022 UTC