Skip to content

Fixed Mcrypt deprecated functions and related tests - #166

Merged
php-pulls merged 1 commit into
php:masterfrom
srgoogleguy:mcrypt-deprecated-functions-tests
Aug 16, 2012
Merged

php-pulls merged 1 commit into
php:masterfrom
srgoogleguy:mcrypt-deprecated-functions-tests

Conversation

@srgoogleguy

Copy link
Copy Markdown
Contributor

This fixes the rest of the deprecated Mcrypt functions that were not previously defined as deprecated as well as their related tests. Sorry this should have been a part of a previous pull request but was only recently brought to my attention by nikic that these functions also needed to be deprecated and that their tests also needed fixed.

@travisbot

Copy link
Copy Markdown

This pull request fails (merged 7014a0e into 6a87a21).

@php-pulls
php-pulls merged commit 7014a0e into php:master Aug 16, 2012
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 12, 2026
Problem

The structs note planned 4 mago-sharp and 4 php-sharp PRs, and refused laws
on a struct. Jordan's direction is that a Slice lands in as few PRs as it
can, because each PR is another full round of suites, review and merge, and
team-lead approved the note with rulings that change three parts of it:
laws on a struct, collection ==, and who adds the harness files.

Solution

"The PRs, in order" now plans one mago-sharp PR and one php-sharp PR for all
of section 10. The mago-sharp PR opens after php#166 merges, and the php-sharp
PR follows the collection Slice's engine PR. A new "Rulings" section records
team-lead's Queue 2. Language rule 12 now lets a struct state laws, collection
== joins the mago-sharp PR, the harness's Username and OrderRow move to
team-lead's spec PR, and the tests gain a struct law row and collection ==
rows.

docs/
└── architecture/
    └── slices/
        └── 10-structs.md   <- Rulings; one PR per repo; struct laws; collection ==
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
feat: a Map's has, keys and remove, filter that keeps its keys, and backed-enum group keys
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
…rule names

Problem: php#166 (Map methods and section 12 key rules) and php#171 (structure rule
names) merged into master, so php#170 conflicted and its CI did not run. Two
files conflicted, and master changed what a type that names no type gives
a value.

Solution: both sides kept, one shape each.

- report_undefined_types, master's loop over a type a declaration writes,
  calls this branch's report_undefined_type, which the `on` clause check
  also calls. master's known_type_or_error stays.
- statement/mod.rs keeps this branch's analyze_emit, is_event and
  is_event_class beside master's report_keys_sharing_entries, and both
  imports.
- known_type_or_error now gives a value of a type that names no type the
  error type, where it was a reference. analyze_emit skips the error type
  in place of a reference, so `emit missing;` for a parameter
  `Missing missing` adds no "`emit` takes an event, and `` is not one."
  beside the error where the type is written. No reference reaches `emit`
  any more.

crates/analyzer/src/statement/
  function_like/mod.rs   report_undefined_types calls report_undefined_type
  mod.rs                 both sides' functions; emit skips the error type
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
Problem

`unset(map[key])` is how PHP removes a Map entry, and the `unset` refusal
named only the end of a local's block. php#166 gave Map a `remove(key)`, so
PHP# has a form for that case, and the message never quoted it.

Solution

The `unset` message quotes both forms: "a local ends at the `}` that closes
its block, and `map.remove(key)` removes a Map's entry." The bridge row that
compiles each removed construct's fix now calls `map.remove(key)`.

crates/
├── semantics/src/internal/checker/sharp.rs    REMOVED_CONSTRUCTS: unset names map.remove(key)
├── semantics/tests/sharp.rs                   the unset row's message
└── sharp-bridge/tests/lower.rs                the quoted map.remove(key) compiles
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
… every Map method

Problem: php#166 gave `Map` its `has`, `get`, `remove` and `keys()`, and
refused a key type that mixes a backed enum with other types wherever a
key goes in or comes out: the loop, `keys()`, the methods, an index, a
literal, `groupBy` and `associateBy`. It also checks a `groupBy` or
`associateBy` key by spec section 12's rule instead of the `array-key`
bound. This branch keys a `Map` by a struct's key text, so each of those
positions must take a struct key as it takes a backed enum, and a
struct that holds a class instance can now reach `groupBy`, where
team-lead's Queue 7 refuses it.

Solution: the shared check is `keys_mix_a_stored_key`, and one class of
keys passes it, one backed enum or one struct, so `Map<Spot|string, int>`
is refused at every position and `Map<Spot, int>` reads and writes
everywhere. `key_read_back`, which the loop and `keys()` share, reads a
struct key back through `\Sharp\Map::readKey`, and `has`, `get` and
`remove` write it through `\Sharp\Map::key` as an index does. A
`groupBy` or `associateBy` key that is a struct holding a class instance
is refused with Queue 7's message, and its `Map` takes the error key, as
a key that keys no `Map` does. `map_key_error` keeps php#166's "may be
null" and names the struct.

Run on the slot 8 engine: `groupBy` and `associateBy` by a struct key
store its key text, a loop and `keys()` read each key back as the
struct, `has` and `get` find an equal struct, and `remove` drops it.

crates/analyzer/src/
├── statement/mod.rs                      <- keys_mix_a_stored_key, key_type_mixes_a_stored_key: one enum or
│                                            one struct; the struct in report_keys_sharing_entries' text
├── statement/function_like/mod.rs        <- map_key_error: php#166's reason with the struct wording
├── invocation/return_type_fetcher.rs     <- a groupBy or associateBy key holding a class instance is refused
└── expression/{array,array_access,assignment/array_assignment,call/method_call}.rs
                                          <- the renamed check
crates/sharp-bridge/src/lower.rs          <- key_read_back takes php#166's signature and keeps the struct arm
crates/analyzer/tests/sharp.rs            <- a_struct_keys_a_map_unless_it_holds_a_class_instance: groupBy rows;
                                             a_map_key_type_that_is_no_value_is_an_error: php#166's rows;
                                             a_map_key_type_that_mixes_a_backed_enum_or_a_struct_with_other_types_
                                             is_refused_where_a_key_goes_in_or_out: a struct at every position
crates/sharp-bridge/tests/lower.rs        <- a_struct_key_goes_in_as_its_key_text_and_a_loop_reads_it_back:
                                             has, get, remove and keys()
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
Master brings braces always, case-sensitive keywords, constructors and
file-level statements (php#173), `?.` on a List index (php#176), and the Map
key checks for groupBy and associateBy (php#166), with php#170 and php#171. The
generics slice keeps its type arguments, statics, class values and
argument checks on top. 21 files conflicted, and every one keeps both
sides.

Parse type hints, locals and events with both sides' rules:
- The `.sharp` lexer keeps a keyword only in exact lowercase, so `List`,
  `Class` and `Function` lex as names. The slice's keyword-kind arms
  for them are dead and are gone. A name followed by `<` starts a
  generic hint, and a name followed by `(` starts a function hint
- A statement may start with `const`, a name or `(`, beside master's
  `emit`. A local declaration uses master's uppercase-name test
- The parse errors keep both NamedConstructorTypeParametersInSharp and
  MiscasedKeywordInSharp
- A method's type parameters live in the arena. With master's `on`
  clause, `Method` grew past clippy's large_enum_variant limit for
  ClassLikeMember, and a local's hint already lives in the arena

Check Map keys once, with the slice's class-value rule:
- A key type is a Map key by the slice's `is_map_key`, so a class value
  keys no Map. Master's groupBy and associateBy paths, its mixed
  backed-enum checks and its read-back of keys stay as master wrote them
- `get_backing_key_type`, `get_sole_backed_enum` and
  `ComparisonResult::for_dialect` take the dialect, as the slice changed
  them, at each of master's new call sites
- A groupBy or associateBy key a class value fills is refused with
  template-constraint-violation, master's code for every key position
- The bridge reads a key back through `Types::backed_enum`, and master's
  duplicate `Lowering::backed_enum` is gone

Keep master's other rules beside the slice's:
- A typed local checks its type arguments, then reports master's
  miscased keyword, then an unknown type
- A static write through a class value with type arguments goes to the
  slice's per-type-argument static, and any other write takes master's
  path
- The checker keeps its type parameter, `on` clause and get-only
  interface property rules in one message each, and drops the stale
  "a type parameter as a catch type is not supported yet"
- The name walker keeps master's `walk_in_on` and the slice's deletion
  of `walk_in_inheritance`
- A `.sharp` call into a plain PHP template bound, `Pick.pair(1, "a")`,
  is refused once by template-constraint-violation, as the slice reports
  every PHP# argument outside a bound

crates/
├── syntax/
│   ├── src/cst/cst/class_like/method.rs        type parameters in the arena
│   ├── src/error.rs                            both sides' parse errors
│   ├── src/parser/internal/
│   │   ├── class_like/method.rs                allocates a method's type parameters
│   │   ├── event.rs                            both sides' event forms
│   │   ├── local_declaration.rs                master's uppercase-name test
│   │   ├── statement.rs                        `emit`, `const`, a name or `(`
│   │   └── type_hint.rs                        a name then `<` or `(` starts a hint
│   └── tests/sharp.rs                          reads the arena type parameters
├── hir/src/lower/error/mod.rs                  lowers both parse errors
├── names/src/
│   ├── binding.rs                              passes a method's type parameters on
│   └── internal/walker.rs                      `walk_in_on`, and type parameters
├── semantics/
│   ├── src/internal/checker/sharp.rs           one message per member rule
│   └── tests/sharp.rs                          both sides' checker tests
├── analyzer/
│   ├── src/expression/
│   │   ├── assignment/array_assignment.rs      master's per-entry check by dialect
│   │   ├── call/method_call.rs                 static writes through a class value
│   │   └── instantiation.rs                    both sides' imports
│   ├── src/invocation/
│   │   ├── analyzer.rs                         both sides' argument checks
│   │   └── return_type_fetcher.rs              master's groupBy path, the slice's key test
│   ├── src/resolver/property.rs                both sides' imports
│   ├── src/statement/
│   │   ├── function_like/mod.rs                `is_map_key` with master's null reason
│   │   ├── mod.rs                              typed locals, Map keys and `emit`
│   │   └── return.rs                           both sides' imports
│   ├── src/utils/expression/array.rs           backing key type by dialect
│   └── tests/sharp.rs                          one issue per bound and key
├── orchestrator/src/service/incremental_analysis/compile.rs   both sides' tests
└── sharp-bridge/src/lower.rs                   key read-back through Types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants