Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/zend_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static bool zend_observer_remove_handler(void **first_handler, const void *old_h
*next_handler = NULL;
} else {
if (cur_handler != last_handler) {
memmove(cur_handler, cur_handler + 1, sizeof(cur_handler) * (last_handler - cur_handler));
memmove(cur_handler, cur_handler + 1, sizeof(*cur_handler) * (last_handler - cur_handler));
}
*last_handler = NULL;
*next_handler = *cur_handler;
Expand Down Expand Up @@ -218,7 +218,7 @@ ZEND_API void zend_observer_add_end_handler(const zend_function *function, zend_
if (*end_handler != ZEND_OBSERVER_NOT_OBSERVED) {
// there's no space for new handlers, then it's forbidden to call this function
ZEND_ASSERT(end_handler[registered_observers - 1] == NULL);
memmove(end_handler + 1, end_handler, sizeof(end_handler) * (registered_observers - 1));
memmove(end_handler + 1, end_handler, sizeof(*end_handler) * (registered_observers - 1));
} else if (*begin_handler == ZEND_OBSERVER_NONE_OBSERVED) {
*begin_handler = ZEND_OBSERVER_NOT_OBSERVED;
}
Expand Down
4 changes: 0 additions & 4 deletions ext/intl/spoofchecker/spoofchecker.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Spoofchecker
public const int INVISIBLE = UNKNOWN;
/** @cvalue USPOOF_CHAR_LIMIT */
public const int CHAR_LIMIT = UNKNOWN;
#if U_ICU_VERSION_MAJOR_NUM >= 58
/** @cvalue USPOOF_ASCII */
public const int ASCII = UNKNOWN;
/** @cvalue USPOOF_HIGHLY_RESTRICTIVE */
Expand All @@ -34,7 +33,6 @@ class Spoofchecker
public const int SINGLE_SCRIPT_RESTRICTIVE = UNKNOWN;
/** @cvalue USPOOF_MIXED_NUMBERS */
public const int MIXED_NUMBERS = UNKNOWN;
#endif
#if U_ICU_VERSION_MAJOR_NUM >= 62
/** @cvalue USPOOF_HIDDEN_OVERLAY */
public const int HIDDEN_OVERLAY = UNKNOWN;
Expand Down Expand Up @@ -71,9 +69,7 @@ public function setAllowedLocales(string $locales): void {}
/** @tentative-return-type */
public function setChecks(int $checks): void {}

#if U_ICU_VERSION_MAJOR_NUM >= 58
/** @tentative-return-type */
public function setRestrictionLevel(int $level): void {}
#endif
public function setAllowedChars(string $pattern, int $patternOptions = 0): void {}
}
10 changes: 1 addition & 9 deletions ext/intl/spoofchecker/spoofchecker_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions ext/intl/spoofchecker/spoofchecker_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ U_CFUNC PHP_METHOD(Spoofchecker, setChecks)
}
/* }}} */

#if U_ICU_VERSION_MAJOR_NUM >= 58
/* TODO Document this method on PHP.net */
/* {{{ Set the loosest restriction level allowed for strings. */
U_CFUNC PHP_METHOD(Spoofchecker, setRestrictionLevel)
{
Expand Down Expand Up @@ -170,7 +170,6 @@ U_CFUNC PHP_METHOD(Spoofchecker, setRestrictionLevel)
uspoof_setRestrictionLevel(co->uspoof, (URestrictionLevel)level);
}
/* }}} */
#endif

U_CFUNC PHP_METHOD(Spoofchecker, setAllowedChars)
{
Expand Down Expand Up @@ -214,9 +213,9 @@ U_CFUNC PHP_METHOD(Spoofchecker, setAllowedChars)
#endif
pattern_option != (USET_IGNORE_SPACE|USET_CASE_INSENSITIVE) &&
pattern_option != (USET_IGNORE_SPACE|USET_ADD_CASE_MAPPINGS)) {
zend_argument_value_error(2, "must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|(<none> or SpoofChecker::USET_CASE_INSENSITIVE or SpoofChecker::USET_ADD_CASE_MAPPINGS"
zend_argument_value_error(2, "must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|(<none> or SpoofChecker::CASE_INSENSITIVE or SpoofChecker::ADD_CASE_MAPPINGS"
#if U_ICU_VERSION_MAJOR_NUM >= 73
" or SpoofChecker::USET_SIMPLE_CASE_INSENSITIVE"
" or SpoofChecker::SIMPLE_CASE_INSENSITIVE"
#endif
"))"
);
Expand Down
6 changes: 0 additions & 6 deletions ext/intl/tests/spoofchecker_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ spoofchecker with restriction level
intl
--SKIPIF--
<?php if(!class_exists("Spoofchecker")) print 'skip'; ?>
<?php
$r = new ReflectionClass("SpoofChecker");
if (false === $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE")) {
die("skip Incompatible ICU version");
}
?>
--FILE--
<?php

Expand Down
2 changes: 1 addition & 1 deletion ext/intl/tests/spoofchecker_008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ try {
bool(true)
bool(false)
bool(false)
Spoofchecker::setAllowedChars(): Argument #2 ($patternOptions) must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|(<none> or SpoofChecker::USET_CASE_INSENSITIVE%s))
Spoofchecker::setAllowedChars(): Argument #2 ($patternOptions) must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|(<none> or SpoofChecker::CASE_INSENSITIVE%s))
Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern
Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern
36 changes: 36 additions & 0 deletions ext/intl/tests/spoofchecker_supported_icu57_apis.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
Spoofchecker exposes restriction-level APIs on all supported ICU versions
--EXTENSIONS--
intl
--SKIPIF--
<?php if (!class_exists("Spoofchecker")) print 'skip'; ?>
--FILE--
<?php
$r = new ReflectionClass("Spoofchecker");

$ascii = $r->getConstant("ASCII");
$singleScriptRestrictive = $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE");
$mixedNumbers = $r->getConstant("MIXED_NUMBERS");

var_dump($ascii !== false);
var_dump($singleScriptRestrictive !== false);
var_dump($mixedNumbers !== false);
var_dump(is_int($ascii));
var_dump(is_int($singleScriptRestrictive));
var_dump(is_int($mixedNumbers));
var_dump($ascii !== $singleScriptRestrictive);
var_dump($ascii !== $mixedNumbers);
var_dump($singleScriptRestrictive !== $mixedNumbers);
var_dump($r->hasMethod("setRestrictionLevel"));
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
2 changes: 0 additions & 2 deletions ext/intl/tests/spoofchecker_unknown_restriction_level.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ intl
--SKIPIF--
<?php
if (!class_exists("Spoofchecker")) print 'skip';

if (!method_exists(new Spoofchecker(), 'setRestrictionLevel')) print 'skip ICU version < 58';
?>
--FILE--
<?php
Expand Down