Skip to content
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

Ephp.eval always fails with no case clause matching error #15

Closed
osbre opened this issue Jun 25, 2023 · 2 comments
Closed

Ephp.eval always fails with no case clause matching error #15

osbre opened this issue Jun 25, 2023 · 2 comments

Comments

@osbre
Copy link

osbre commented Jun 25, 2023

Expected Behavior

out variable from out = EphpContext.get_output(ctx) contains hello worldthis is awesome

https://github.com/osbre/ephp_web/blob/main/lib/ephp_web/ephp_plug.ex#L34

Actual Behavior

getting an error 👀

** (CaseClauseError) no case clause matching: {:EXIT, {:function_clause, [{:ephp_interpr, :run, [#Reference<0.4106486204.4208197636.168118>, {:{}, [], [:print_text, "hello world\n", {{:line, 1}, {:column, 2}}]}, false], [file: ~c"/home/o/code/ephp_web/deps/ephp/src/ephp_interpr.erl", line: 77]}, {:lists, :foldl, 3, [file: ~c"lists.erl", line: 1350]}, {:ephp_interpr, :process, 3, [file: ~c"/home/o/code/ephp_web/deps/ephp/src/ephp_interpr.erl", line: 25]}, {:ephp, :eval, 3, [file: ~c"/home/o/code/ephp_web/deps/ephp/src/ephp.erl", line: 182]}, {EphpWeb.EphpPlug, :call, 2, [file: ~c"lib/ephp_web/ephp_plug.ex", line: 34]}, {Bandit.Pipeline, :call_plug, 2, [file: ~c"lib/bandit/pipeline.ex", line: 110]}, {Bandit.Pipeline, :run, 6, [file: ~c"lib/bandit/pipeline.ex", line: 25]}, {Bandit.HTTP1.Handler, :handle_data, 3, [file: ~c"lib/bandit/http1/handler.ex", line: 27]}]}}

message from the terminal window

Steps to Reproduce the Problem

Linked GitHub repository to easily reproduce the problem: https://github.com/osbre/ephp_web

  1. git clone git@github.com:osbre/ephp_web.git && cd ephp_web
  2. mix deps.get
  3. mix run --no-halt
  4. curl http://0.0.0.0:4000
  5. Check the output from command 3

Specifications

  • Version:
    • ephp: latest from the master branch, therefore commit d32fc68
      • same result with 0.3.1 from Hex.
    • Elixir 1.15.0 (compiled with Erlang/OTP 25)
    • Erlang/OTP 25 [erts-13.2.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
  • Platform: Linux
  • Subsystem: Linux Mint 21 with 5.15.0-75-generic kernel
@manuel-rubio
Copy link
Member

@osbre if you remove the following line it should work perfectly fine:

      |> Macro.escape()

Remember that the parse for ePHP isn't a parse in the sense of Elixir, or Erlang. It's only a tokenization of the PHP code, and it shouldn't be modified.

@osbre
Copy link
Author

osbre commented Jul 30, 2023

Thank you! It solved my problem

@osbre osbre closed this as completed Jul 30, 2023
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

No branches or pull requests

2 participants