-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP-CPP method not invoked at all when being passed wrong arguments #397
Comments
Note that PHP promptly warns:
|
Actually, the expected output would be the native PHP behavior, which is to throw bugreport_php.php
Output:
Log: |
I would like to investigate this issue to dive into php-cpp source code. |
I compiled libphpcpp today from clone master. My bugreport2.php is #!/usr/bin/env php
<?php
declare(strict_types=1);
$result = @extension_loaded('bugreport');
if (false === $result) die("error extension loaded bugreport.so\n");
$a = new testClass('hello', 'world');
$a->method();
unset($a);
echo '----------------------------------------', PHP_EOL;
// Here, the invocation of testClass::__construct() is being skipped, resulting in unconstructed PHP object.
$a = new testClass('hello');
// Yet, method() is invoked
$a->method(); and the log is testClass::testClass() (CPP constructor)
testClass::__construct() (PHP constructor)
testClass::method()
testClass::__destruct() (PHP destructor)
testClass::~testClass() (CPP destructor)
----------------------------------------
testClass::testClass() (CPP constructor)
PHP Warning: __construct() expects at least 2 parameter(s), 1 given in bugreport/bugreport2.php on line 16
testClass::method()
testClass::__destruct() (PHP destructor)
testClass::~testClass() (CPP destructor) It seems that it works fine for me. No invocation is skipped. |
Hello,
I have a problem where a method (specifically,
__construct
) is not being called at all when provided with wrong number of arguments, resulting in unconstructed PHP object.PHP version:
PHP-CPP version; current master
bugreport.cpp
bugreport.php
Expected output:
Actual output:
Kind regards,
The text was updated successfully, but these errors were encountered: