We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Zep code:
namespace Xxx; class Buggy { public static function bugCompare() { var str; let str = strtolower("testing"); if str === "wrong testing" { let str = "NOK"; } else { if str === "another testing" { let str = "NOK"; } else { if str === "testing" { let str = "OK"; } else { let str = "NOK"; } } } return str; } }
C code:
#ifdef HAVE_CONFIG_H #include "../ext_config.h" #endif #include <php.h> #include "../php_ext.h" #include "../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/memory.h" #include "kernel/string.h" #include "kernel/operators.h" ZEPHIR_INIT_CLASS(Xxx_Buggy) { ZEPHIR_REGISTER_CLASS(Xxx, Buggy, xxx, buggy, xxx_buggy_method_entry, 0); return SUCCESS; } PHP_METHOD(Xxx_Buggy, bugCompare) { zval *str, _0; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(str); ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "testing", 0); zephir_fast_strtolower(str, &_0); if (ZEPHIR_IS_STRING(str, "wrong testing")) { ZEPHIR_INIT_BNVAR(str); ZVAL_STRING(str, "NOK", 1); } else { if (ZEPHIR_IS_STRING(str, "another testing")) { ZEPHIR_INIT_BNVAR(str); ZVAL_STRING(str, "NOK", 1); } else { ZEPHIR_INIT_BNVAR(str); if (ZEPHIR_IS_STRING(str, "testing")) { ZVAL_STRING(str, "OK", 1); } else { ZVAL_STRING(str, "NOK", 1); } } } RETURN_CCTOR(str); }
Return expected: OK Returned: NOK
This is the part where mess the comparison:
ZEPHIR_INIT_BNVAR(str); if (ZEPHIR_IS_STRING(str, "testing")) {
Zephir is initializing the same variable that will be tested.
The text was updated successfully, but these errors were encountered:
Marked this as bug, thx you for report :) will try to fix this now
Sorry, something went wrong.
Fix zephir-lang#411 Issue about SkipVariantInit bug
9cef028
d3ea6d6
Fixed, w8 @phalcon review :)
05ac183
Merge pull request #413 from ovr/441_issue
35a64fd
Fix #411 Issue about SkipVariantInit bug
No branches or pull requests
Zep code:
C code:
Return expected: OK
Returned: NOK
This is the part where mess the comparison:
Zephir is initializing the same variable that will be tested.
The text was updated successfully, but these errors were encountered: